public HttpResponse doIndex() throws IOException { return new HttpRedirect("manage"); }
public HttpResponse doIndex(StaplerResponse rsp) throws IOException { return new HttpRedirect("manage"); }
/** * Configure the logging level. */ @edu.umd.cs.findbugs.annotations.SuppressFBWarnings("LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE") @RequirePOST public HttpResponse doConfigLogger(@QueryParameter String name, @QueryParameter String level) { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); Level lv; if(level.equals("inherit")) lv = null; else lv = Level.parse(level.toUpperCase(Locale.ENGLISH)); Logger.getLogger(name).setLevel(lv); return new HttpRedirect("levels"); }
/** * Creates a new log recorder. */ @RequirePOST public HttpResponse doNewLogRecorder(@QueryParameter String name) { Jenkins.checkGoodName(name); logRecorders.put(name,new LogRecorder(name)); // redirect to the config screen return new HttpRedirect(name+"/configure"); }
/** * Quiet down Jenkins - preparation for a restart * * @param block Block until the system really quiets down and no builds are running * @param timeout If non-zero, only block up to the specified number of milliseconds */ @RequirePOST public HttpRedirect doQuietDown(@QueryParameter boolean block, @QueryParameter int timeout) throws InterruptedException, IOException { synchronized (this) { checkPermission(ADMINISTER); isQuietingDown = true; } if (block) { long waitUntil = timeout; if (timeout > 0) waitUntil += System.currentTimeMillis(); while (isQuietingDown && (timeout <= 0 || System.currentTimeMillis() < waitUntil) && !RestartListener.isAllReady()) { Thread.sleep(1000); } } return new HttpRedirect("."); }
/** * Depending on whether the user said "yes" or "no", send him to the right place. */ @RequirePOST public HttpResponse doAct(@QueryParameter String no) throws IOException { if(no!=null) { // dismiss disable(true); // of course the irony is that this redirect won't work return HttpResponses.redirectViaContextPath("/manage"); } else { return new HttpRedirect("https://jenkins.io/redirect/troubleshooting/broken-reverse-proxy"); } }
public HttpResponse doIndex() { return new HttpRedirect("view/" + Util.rawEncode(getPrimaryView().getViewName()) + "/"); }
public HttpResponse doTest() { String referer = Stapler.getCurrentRequest().getReferer(); Jenkins j = Jenkins.getInstance(); // May need to send an absolute URL, since handling of HttpRedirect with a relative URL does not currently honor X-Forwarded-Proto/Port at all. String redirect = j.getRootUrl() + "administrativeMonitor/" + id + "/testForReverseProxySetup/" + (referer != null ? Util.rawEncode(referer) : "NO-REFERER") + "/"; LOGGER.log(Level.FINE, "coming from {0} and redirecting to {1}", new Object[] {referer, redirect}); return new HttpRedirect(redirect); }
/** * Cancel previous quiet down Jenkins - preparation for a restart */ @RequirePOST // TODO the cancel link needs to be updated accordingly public synchronized HttpRedirect doCancelQuietDown() { checkPermission(ADMINISTER); isQuietingDown = false; getQueue().scheduleMaintenance(); return new HttpRedirect("."); }
/** * Depending on whether the user said "yes" or "no", send him to the right place. */ @RequirePOST public HttpResponse doAct(StaplerRequest req, StaplerResponse rsp) throws IOException { if (req.hasParameter("no")) { disable(true); return HttpResponses.redirectViaContextPath("/manage"); } else { return new HttpRedirect("manage"); } }
@CLIMethod(name="enable-job") @RequirePOST default HttpResponse doEnable() throws IOException, ServletException { checkPermission(CONFIGURE); makeDisabled(false); return new HttpRedirect("."); }
@CLIMethod(name="disable-job") @RequirePOST default HttpResponse doDisable() throws IOException, ServletException { checkPermission(CONFIGURE); makeDisabled(true); return new HttpRedirect("."); }
@RequirePOST public HttpResponse doDoDisconnect(@QueryParameter String offlineMessage) { if (channel!=null) { //does nothing in case computer is already disconnected checkPermission(DISCONNECT); offlineMessage = Util.fixEmptyAndTrim(offlineMessage); disconnect(new OfflineCause.UserCause(User.current(), offlineMessage)); } return new HttpRedirect("."); }
/** * Bare-minimum configuration mechanism to change the update center. */ @RequirePOST public HttpResponse doSiteConfigure(@QueryParameter String site) throws IOException { Jenkins hudson = Jenkins.getInstance(); hudson.checkPermission(CONFIGURE_UPDATECENTER); UpdateCenter uc = hudson.getUpdateCenter(); PersistedList<UpdateSite> sites = uc.getSites(); for (UpdateSite s : sites) { if (s.getId().equals(UpdateCenter.ID_DEFAULT)) sites.remove(s); } sites.add(new UpdateSite(UpdateCenter.ID_DEFAULT, site)); return new HttpRedirect("advanced"); }
/** * When the agent is deleted, free the node right away. */ @Override @RequirePOST public HttpResponse doDoDelete() throws IOException { checkPermission(DELETE); try { T node = getNode(); if (node != null) { // No need to terminate nodes again node.terminate(); } return new HttpRedirect(".."); } catch (InterruptedException e) { return HttpResponses.error(500,e); } } }
/** * Called from the management screen. */ @RequirePOST public HttpResponse doAct(StaplerRequest req) throws ServletException, IOException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); if(req.hasParameter("n")) { // we'll shut up disable(true); return HttpResponses.redirectViaContextPath("/manage"); } return new HttpRedirect("confirm"); }
@RequirePOST public HttpResponse doUpdateSources(StaplerRequest req) throws IOException { Jenkins.getInstance().checkPermission(CONFIGURE_UPDATECENTER); if (req.hasParameter("remove")) { UpdateCenter uc = Jenkins.getInstance().getUpdateCenter(); BulkChange bc = new BulkChange(uc); try { for (String id : req.getParameterValues("sources")) uc.getSites().remove(uc.getById(id)); } finally { bc.commit(); } } else if (req.hasParameter("add")) return new HttpRedirect("addSite"); return new HttpRedirect("./sites"); }
/** * Really deletes the agent. */ @RequirePOST public HttpResponse doDoDelete() throws IOException { checkPermission(DELETE); Node node = getNode(); if (node != null) { Jenkins.getInstance().removeNode(node); } else { AbstractCIBase app = Jenkins.getInstance(); app.removeComputer(this); } return new HttpRedirect(".."); }
@RequirePOST public HttpResponse doProxyConfigure(StaplerRequest req) throws IOException, ServletException { Jenkins jenkins = Jenkins.getInstance(); jenkins.checkPermission(CONFIGURE_UPDATECENTER); ProxyConfiguration pc = req.bindJSON(ProxyConfiguration.class, req.getSubmittedForm()); if (pc.name==null) { jenkins.proxy = null; ProxyConfiguration.getXmlFile().delete(); } else { jenkins.proxy = pc; jenkins.proxy.save(); } return new HttpRedirect("advanced"); }
/** * Wipes out the workspace. */ @RequirePOST public HttpResponse doDoWipeOutWorkspace() throws IOException, ServletException, InterruptedException { checkPermission(Functions.isWipeOutPermissionEnabled() ? WIPEOUT : BUILD); R b = getSomeBuildWithWorkspace(); FilePath ws = b!=null ? b.getWorkspace() : null; if (ws!=null && getScm().processWorkspaceBeforeDeletion(this, ws, b.getBuiltOn())) { ws.deleteRecursive(); for (WorkspaceListener wl : WorkspaceListener.all()) { wl.afterDelete(this); } return new HttpRedirect("."); } else { // If we get here, that means the SCM blocked the workspace deletion. return new ForwardToView(this,"wipeOutWorkspaceBlocked.jelly"); } }