/** * Obtains the heap dump. */ public void doIndex(StaplerResponse rsp) throws IOException { rsp.sendRedirect("heapdump.hprof"); }
public synchronized void doTestPost( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { rsp.sendRedirect("foo"); }
/** * Depending on whether the user said "dismiss" or "correct", send him to the right place. */ public void doAct(StaplerRequest req, StaplerResponse rsp) throws IOException { if(req.hasParameter("correct")) { rsp.sendRedirect(req.getContextPath()+"/pluginManager"); } }
@Override // in case schedulePolling was overridden public void doPolling( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { BuildAuthorizationToken.checkPermission((Job) this, authToken, req, rsp); schedulePolling(); rsp.sendRedirect("."); }
/** * Depending on whether the user said "yes" or "no", send him to the right place. */ @RequirePOST public void doAct(StaplerRequest req, StaplerResponse rsp) throws IOException { if(req.hasParameter("no")) { disable(true); rsp.sendRedirect(req.getContextPath()+"/manage"); } else { rsp.sendRedirect(req.getContextPath()+"/newView"); } }
/** * Depending on whether the user said "yes" or "no", send him to the right place. */ @RequirePOST public void doAct(StaplerRequest req, StaplerResponse rsp) throws IOException { if(req.hasParameter("no")) { disable(true); rsp.sendRedirect(req.getContextPath()+"/manage"); } else { rsp.sendRedirect(req.getContextPath()+"/configureSecurity"); } } }
/** * 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 }
/** * Performs the installation of the plugins. */ @RequirePOST public void doInstall(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); Set<String> plugins = new LinkedHashSet<>(); Enumeration<String> en = req.getParameterNames(); while (en.hasMoreElements()) { String n = en.nextElement(); if(n.startsWith("plugin.")) { n = n.substring(7); plugins.add(n); } } boolean dynamicLoad = req.getParameter("dynamicLoad")!=null; install(plugins, dynamicLoad); rsp.sendRedirect("../updateCenter/"); }
/** * Creates a user account. Requires {@link Jenkins#ADMINISTER} */ @Restricted(NoExternalUse.class) public User createAccountByAdmin(StaplerRequest req, StaplerResponse rsp, String addUserView, String successView) throws IOException, ServletException { checkPermission(Jenkins.ADMINISTER); User u = createAccount(req, rsp, false, addUserView); if (u != null && successView != null) { rsp.sendRedirect(successView); } return u; }
@RequirePOST @Override public void doLaunchSlaveAgent(StaplerRequest req, StaplerResponse rsp) throws IOException { checkPermission(CONNECT); if(channel!=null) { try { req.getView(this, "already-launched.jelly").forward(req, rsp); } catch (IOException x) { throw x; } catch (/*Servlet*/Exception x) { throw new IOException(x); } return; } connect(true); // TODO: would be nice to redirect the user to "launching..." wait page, // then spend a few seconds there and poll for the completion periodically. rsp.sendRedirect("log"); }
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { if (isApply(req)) { // if the submission is via 'apply', show a response in the notification bar applyResponse("notificationBar.show('"+Messages.HttpResponses_Saved()+"',notificationBar.OK)") .generateResponse(req,rsp,node); } else { rsp.sendRedirect(destination); } } };
/** * 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 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 }
/** * Schedules a new SCM polling command. */ @SuppressWarnings("deprecation") default void doPolling(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { if (!(this instanceof SCMTriggerItem)) { rsp.sendError(404); return; } hudson.model.BuildAuthorizationToken.checkPermission((Job) this, getAuthToken(), req, rsp); ((SCMTriggerItem) this).schedulePolling(); rsp.sendRedirect("."); }
/** * Clears the error status. */ @RequirePOST public synchronized void doClearError(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { getACL().checkPermission(getPermission()); if(workerThread!=null && !workerThread.isRunning()) workerThread = null; rsp.sendRedirect("."); } }
public void buildWithParameters(StaplerRequest req, StaplerResponse rsp, @CheckForNull TimeDuration delay) throws IOException, ServletException { List<ParameterValue> values = new ArrayList<ParameterValue>(); for (ParameterDefinition d: parameterDefinitions) { ParameterValue value = d.createValue(req); if (value != null) { values.add(value); } } if (delay==null) delay=new TimeDuration(TimeUnit.MILLISECONDS.convert(getJob().getQuietPeriod(), TimeUnit.SECONDS)); Queue.Item item = Jenkins.getInstance().getQueue().schedule2( getJob(), delay.getTimeInSeconds(), new ParametersAction(values), ParameterizedJobMixIn.getBuildCause(getJob(), req)).getItem(); if (item != null) { rsp.sendRedirect(SC_CREATED, req.getContextPath() + '/' + item.getUrl()); } else { rsp.sendRedirect("."); } }
@RequirePOST public void do_launchAll(StaplerRequest req, StaplerResponse rsp) throws IOException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); for(Computer c : get_all()) { if(c.isLaunchSupported()) c.connect(true); } rsp.sendRedirect("."); }
/** * 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 }
/** * Accepts submission from the node configuration page. */ @RequirePOST public synchronized void doConfigExecutorsSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException { checkPermission(ADMINISTER); BulkChange bc = new BulkChange(this); try { JSONObject json = req.getSubmittedForm(); ExtensionList.lookupSingleton(MasterBuildConfiguration.class).configure(req,json); getNodeProperties().rebuild(req, json.optJSONObject("nodeProperties"), NodeProperty.all()); } finally { bc.commit(); } updateComputerList(); rsp.sendRedirect(req.getContextPath()+'/'+toComputer().getUrl()); // back to the computer page }