private String selectedValue(HTTPRequest request) { if (request.isParameterSet(filenameField()) && (request.isParameterSet(selectDir) || request.isParameterSet(selectFile))) { //Request is a GET. return request.getParam(filenameField()); } else if (request.isPartSet(filenameField()) && (request.isPartSet(selectDir) || request.isPartSet(selectFile))) { //Request is a POST. return request.getPartAsStringFailsafe(filenameField(), MAX_POST_SIZE); } return null; }
/** Call this before getPageNode(), so the menus reflect the advanced mode setting. */ public int parseMode(HTTPRequest req, ToadletContainer container) { int mode = container.isAdvancedModeEnabled() ? MODE_ADVANCED : MODE_SIMPLE; if(req.isParameterSet(MODE_SWITCH_PARAMETER)) { mode = req.getIntParam(MODE_SWITCH_PARAMETER, mode); if(mode == MODE_ADVANCED) container.setAdvancedMode(true); else container.setAdvancedMode(false); } return mode; }
if (path.equals("/") && req.isParameterSet("newbookmark") && !forBaseHref) {
boolean isSet = true; if(request.isParameterSet("sortBy")){ final String sortBy = request.getParam("sortBy"); }else if(request.isParameterSet("reversed")){ isReversed = true; return result > 0 ? -1 : 1;
} else if (currentStep == WIZARD_STEP.SECURITY_NETWORK && !request.isParameterSet("opennet")) {
return; if (request.isParameterSet("peernode_hashcode")) { PageNode page = ctx.getPageMaker().getPageNode(l10n("sendMessage"), ctx); HTMLNode pageNode = page.outer;
public void handleMethodGET(URI uri, HTTPRequest request, ToadletContext ctx) throws ToadletContextClosedException, IOException { if (request.isParameterSet("wontload")) return; else if (request.isParameterSet("mimeTest")){ this.writeHTMLReply(ctx, 200, "OK", imgWarningMime); return;
@Override public void getStep(HTTPRequest request, PageHelper helper) { boolean incognito = request.isParameterSet("incognito");
if (request.isParameterSet("parseError")) { parseErrorBox(contentNode, helper, WizardL10n.l10n("bandwidthCouldNotParse", "limit", parseTarget)); } else if (request.isParameterSet("tooLow")) { HTMLNode errorBox = parseErrorBox(contentNode, helper, WizardL10n.l10n("bandwidthMonthlyLow", new String[] { "requested", "minimum", "useMinimum" },
Arrays.sort(peerNodeStatuses, comparator(request.getParam("sortBy", null), request.isParameterSet("reversed")));
public void handleMethodGET(URI uri, HTTPRequest request, ToadletContext ctx) throws ToadletContextClosedException, IOException { if (ctx.isAllowedFullAccess()) { if (request.isParameterSet("latestlog")) { final File logs = new File(node.config.get("logger").getString("dirname") + File.separator + "freenet-latest.log"); String text = readLogTail(logs, 100000); this.writeTextReply(ctx, 200, "OK", text); return; } else if (request.isParameterSet("terminated")) { if ((!request.isParameterSet("formPassword")) || !request.getParam("formPassword").equals(ctx.getFormPassword())) { redirectToRoot(ctx); return; } else if (request.isParameterSet("restarted")) { if ((!request.isParameterSet("formPassword")) || !request.getParam("formPassword").equals(ctx.getFormPassword())) { redirectToRoot(ctx); return; if(request.isParameterSet("hasAnActivelink")) { addForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"hidden","hasAnActivelink",request.getParam("hasAnActivelink")});
/** * Renders the first page of the wizard into the given content node. * @param request used to check whether the user is using a browser with incognito mode. */ @Override public void getStep(HTTPRequest request, PageHelper helper) { HTMLNode contentNode = helper.getPageContent(WizardL10n.l10n("homepageTitle")); boolean incognito = request.isParameterSet("incognito"); HTMLNode optionsTable = contentNode.addChild("table"); HTMLNode tableHeader = optionsTable.addChild("tr"); HTMLNode tableRow = optionsTable.addChild("tr"); //Low security option addSecurityTableCell(tableHeader, tableRow, "Low", helper, incognito); //High security option addSecurityTableCell(tableHeader, tableRow, "High", helper, incognito); //Detailed wizard option addSecurityTableCell(tableHeader, tableRow, "None", helper, incognito); HTMLNode languageForm = helper.addFormChild(contentNode, ".", "languageForm"); //Add option dropdown for languages Option<?> language = config.get("node").getOption("l10n"); EnumerableOptionCallback l10nCallback = (EnumerableOptionCallback)language.getCallback(); HTMLNode dropDown = ConfigToadlet.addComboBox(language.getValueDisplayString(), l10nCallback, language.getName(), false); //Submit automatically upon selection if Javascript. dropDown.addAttribute("onchange", "this.form.submit()"); languageForm.addChild(dropDown); //Otherwise fall back to submit button if no Javascript languageForm.addChild("noscript").addChild("input", "type", "submit"); }
if(logMINOR) Logger.minor(this, "UA = "+ua+" accept = "+accept); final boolean canSendProgress = isBrowser(ua) && !ctx.disableProgressPage() && (accept == null || accept.indexOf("text/html") > -1) && !httprequest.isParameterSet("forcedownload"); maxSizeDownload = MAX_LENGTH_WITH_PROGRESS; if(!restricted) { if(httprequest.isParameterSet("max-size")) { maxSize = maxSizeDownload = httprequest.getLongParam("max-size", defaultMaxSize); overrideSize = true; if (httprequest.isParameterSet("key")) { String k = httprequest.getParam("key"); FreenetURI newURI; String location = getLink(newURI, requestedMimeType, maxSize, httprequest.getParam("force", null), httprequest.isParameterSet("forcedownload"), maxRetries, overrideSize); writeTemporaryRedirect(ctx, null, location); return; if (!force && !httprequest.isParameterSet("forcedownload")) fctx.filterData = true; else if(logMINOR) Logger.minor(this, "Content filter disabled via request parameter"); fctx.overrideMIME = requestedMimeType; String override = (requestedMimeType == null) ? "" : "?type="+URLEncoder.encode(requestedMimeType,true); String maybeCharset = httprequest.isParameterSet("maybecharset") ? httprequest.getParam("maybecharset", null) : null; fctx.charset = maybeCharset; if(override.equals("") && maybeCharset != null) if(httprequest.isParameterSet("forcedownload")) { if(override.length() == 0) override = "?forcedownload";
return; boolean showEverything = !request.isParameterSet("toTranslateOnly"); if (request.isParameterSet("getOverrideTranlationFile")) { SimpleFieldSet sfs = this.base.getOverrideForCurrentLanguageTranslation(); if(sfs == null) { ctx.writeData(data); return; } else if (request.isParameterSet("translation_updated")) { String key = request.getParam("translation_updated"); PageNode page = ctx.getPageMaker().getPageNode(l10n("translationUpdatedTitle"), ctx); } else if (request.isParameterSet("translate")) { boolean gotoNext = request.isParameterSet("gotoNext"); String key = request.getParam("translate"); PageNode page = ctx.getPageMaker().getPageNode(l10n("translationUpdateTitle"), ctx); this.writeHTMLReply(ctx, 200, "OK", pageNode.generate()); return; } else if (request.isParameterSet("remove")) { String key = request.getParam("remove"); PageNode page = ctx.getPageMaker().getPageNode(l10n("removeOverrideTitle"), ctx);
if (request.isParameterSet("parseError")) { parseErrorBox(contentNode, helper, request.getParam("parseTarget"));
@Override public void getStep(HTTPRequest request, PageHelper helper) { if (request.isParameterSet("error")) { if (errorHandler(request, helper)) {
boolean opennet = Fields.stringToBool(opennetParam, false); if (request.isParameterSet("confirm")) { String networkThreatLevel = request.getParam("security-levels.networkThreatLevel"); SecurityLevels.NETWORK_THREAT_LEVEL newThreatLevel = SecurityLevels.parseNetworkThreatLevel(networkThreatLevel);