private boolean isRedirect(JSONObject reply) { return reply.has(InternalConstants.PARTIAL_KEY) && reply.in(InternalConstants.PARTIAL_KEY).has("redirectURL"); }
public void processResultValue(URL value) throws IOException { JSONObject response = new JSONObject(); response.in(InternalConstants.PARTIAL_KEY).put("redirectURL", value.toExternalForm() ); masterProcessor.processResultValue(response); } }
private void addModuleToConfig(JSONObject config, String name, JavaScriptModuleConfiguration module) { JSONObject shimConfig = config.in("shim"); boolean nestDependencies = false; String exports = module.getExports(); if (exports != null) { shimConfig.in(name).put("exports", exports); nestDependencies = true; } String initExpression = module.getInitExpression(); if (initExpression != null) { String function = String.format("function() { return %s; }", initExpression); shimConfig.in(name).put("init", new JSONLiteral(function)); nestDependencies = true; } List<String> dependencies = module.getDependencies(); if (dependencies != null) { JSONObject container = nestDependencies ? shimConfig.in(name) : shimConfig; String key = nestDependencies ? "deps" : name; for (String dep : dependencies) { container.append(key, dep); } } }
/** * Commits changes, adding one or more keys to the reply. * * @param reply * JSON Object to be sent to client */ public void commit(JSONObject reply) { if (libraryURLs.length() > 0) { reply.in(InternalConstants.PARTIAL_KEY).put("libraries", libraryURLs); } if (stylesheets.length() > 0) { reply.in(InternalConstants.PARTIAL_KEY).put("stylesheets", stylesheets); } List<?> inits = initsManager.getSortedInits(); if (inits.size() > 0) { reply.in(InternalConstants.PARTIAL_KEY).put("inits", JSONArray.from(inits)); } } }
public void processResultValue(Link value) throws IOException { JSONObject response = new JSONObject(); response.in(InternalConstants.PARTIAL_KEY).put("redirectURL", value.toRedirectURI()); masterProcessor.processResultValue(response); } }
reply.in(InternalConstants.PARTIAL_KEY).put("redirectURL", link.toRedirectURI());