/** * Is this submission from the "apply" button? */ public static boolean isApply(StaplerRequest req) { return Boolean.parseBoolean(req.getParameter("core:apply")); }
public static BuildAuthorizationToken create(StaplerRequest req) { if (req.getParameter("pseudoRemoteTrigger") != null) { String token = Util.fixEmpty(req.getParameter("authToken")); if(token!=null) return new BuildAuthorizationToken(token); } return null; }
/** * Gets the parameter as a file. */ protected final File getFileParameter(String paramName) { return new File(Util.fixNull(request.getParameter(paramName))); }
/** * @deprecated as of 1.294 * Define your own check method, instead of relying on this generic one. */ @Deprecated public void doFieldCheck(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { doFieldCheck( fixEmpty(req.getParameter("value")), fixEmpty(req.getParameter("type")), fixEmpty(req.getParameter("errorText")), fixEmpty(req.getParameter("warningText"))).generateResponse(req,rsp,this); }
/** @deprecated use {@link #doBuildWithParameters(StaplerRequest, StaplerResponse, TimeDuration)} */ @Deprecated public void doBuildWithParameters(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { doBuildWithParameters(req, rsp, TimeDuration.fromString(req.getParameter("delay"))); }
/** @deprecated use {@link #_doBuild(StaplerRequest, StaplerResponse, TimeDuration)} */ @Deprecated public void _doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { _doBuild(req, rsp, TimeDuration.fromString(req.getParameter("delay"))); }
/** @deprecated use {@link #buildWithParameters(StaplerRequest, StaplerResponse, TimeDuration)} */ @Deprecated public void buildWithParameters(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { buildWithParameters(req,rsp,TimeDuration.fromString(req.getParameter("delay"))); }
/** @deprecated use {@link #doBuild(StaplerRequest, StaplerResponse, TimeDuration)} */ @Deprecated public void doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { doBuild(req, rsp, TimeDuration.fromString(req.getParameter("delay"))); }
/** * Exposes the bean as JSON. */ public void doJson(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { if (req.getParameter("jsonp") == null || permit(req)) { setHeaders(rsp); rsp.serveExposedBean(req,bean, req.getParameter("jsonp") == null ? Flavor.JSON : Flavor.JSONP); } else { rsp.sendError(HttpURLConnection.HTTP_FORBIDDEN, "jsonp forbidden; implement jenkins.security.SecureRequester"); } }
private boolean needToAddToCurrentView(StaplerRequest req) throws ServletException { String json = req.getParameter("json"); if (json != null && json.length() > 0) { // Submitted via UI JSONObject form = req.getSubmittedForm(); return form.has("addToCurrentView") && form.getBoolean("addToCurrentView"); } else { // Submitted via API return true; } }
/** * Renames this job. * @deprecated Exists for backwards compatibility, use {@link #doConfirmRename} instead. */ @Deprecated @RequirePOST public/* not synchronized. see renameTo() */void doDoRename( StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { String newName = req.getParameter("newName"); doConfirmRename(newName).generateResponse(req, rsp, null); }
public FormValidation doCheckURIEncoding(StaplerRequest request) throws IOException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); // expected is non-ASCII String final String expected = "\u57f7\u4e8b"; final String value = fixEmpty(request.getParameter("value")); if (!expected.equals(value)) return FormValidation.warningWithMarkup(hudson.model.Messages.Hudson_NotUsesUTF8ToDecodeURL()); return FormValidation.ok(); } }
/** * Accepts the new description. */ @RequirePOST public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { setDescription(req.getParameter("description")); rsp.sendRedirect("."); // go to the top page }
protected void check() throws IOException, ServletException { try { String value = request.getParameter("value"); if(Integer.parseInt(value)<0) error(hudson.model.Messages.Hudson_NotAPositiveNumber()); else ok(); } catch (NumberFormatException e) { error(hudson.model.Messages.Hudson_NotANumber()); } } }
public HttpResponse doToggleCollapse() throws ServletException, IOException { final StaplerRequest request = Stapler.getCurrentRequest(); final String paneId = request.getParameter("paneId"); PaneStatusProperties.forCurrentUser().toggleCollapsed(paneId); return HttpResponses.forwardToPreviousPage(); }
/** * Accepts the new description. */ @RequirePOST public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { checkPermission(CONFIGURE); description = req.getParameter("description"); save(); rsp.sendRedirect("."); // go to the top page }
/** * Accepts the new description. */ @RequirePOST public void doSubmitDescription(StaplerRequest req, StaplerResponse rsp) throws IOException { checkPermission(Jenkins.ADMINISTER); description = req.getParameter("description"); save(); rsp.sendRedirect("."); // go to the top page }
/** * Accepts the new description. */ @RequirePOST public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { checkPermission(CONFIGURE); setDescription(req.getParameter("description")); rsp.sendRedirect("."); // go to the top page }
/** * Accepts the new description. */ @RequirePOST @Restricted(DoNotUse.class) public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); setDescription(req.getParameter("description")); rsp.sendRedirect("."); // go to the top page }
@Restricted(NoExternalUse.class) // for cc.xml.jelly public static Collection<TopLevelItem> getCCItems(View v) { if (Stapler.getCurrentRequest().getParameter("recursive") != null) { return v.getOwner().getItemGroup().getAllItems(TopLevelItem.class); } else { return v.getItems(); } }