Example #1
0
 private void redirectToBuildPage(StaplerResponse res, Run build) {
   if (build != null) {
     try {
       res.sendRedirect2(Jenkins.getInstance().getRootUrl() + build.getUrl());
     } catch (IOException e) {
       try {
         res.sendRedirect2(Jenkins.getInstance().getRootUrl() + build.getBuildStatusUrl());
       } catch (IOException e1) {
         e1.printStackTrace();
       }
     }
   }
 }
Example #2
0
  public void doIndex(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException {
    List<Ancestor> l = req.getAncestors();
    for (int i = l.size() - 1; i >= 0; i--) {
      Ancestor a = l.get(i);
      if (a.getObject() instanceof SearchableModelObject) {
        SearchableModelObject smo = (SearchableModelObject) a.getObject();

        SearchIndex index = smo.getSearchIndex();
        String query = req.getParameter("q");
        if (query != null) {
          SuggestedItem target = find(index, query);
          if (target != null) {
            // found
            rsp.sendRedirect2(a.getUrl() + target.getUrl());
            return;
          }
        }
      }
    }

    // no exact match. show the suggestions
    rsp.setStatus(SC_NOT_FOUND);
    req.getView(this, "search-failed.jelly").forward(req, rsp);
  }
Example #3
0
  public static View create(StaplerRequest req, StaplerResponse rsp, ViewGroup owner)
      throws FormException, IOException, ServletException {
    String requestContentType = req.getContentType();
    if (requestContentType == null) throw new Failure("No Content-Type header set");

    boolean isXmlSubmission =
        requestContentType.startsWith("application/xml")
            || requestContentType.startsWith("text/xml");

    String name = req.getParameter("name");
    checkGoodName(name);
    if (owner.getView(name) != null)
      throw new FormException(Messages.Hudson_ViewAlreadyExists(name), "name");

    String mode = req.getParameter("mode");
    if (mode == null || mode.length() == 0) {
      if (isXmlSubmission) {
        View v;
        v = createViewFromXML(name, req.getInputStream());
        v.owner = owner;
        rsp.setStatus(HttpServletResponse.SC_OK);
        return v;
      } else throw new FormException(Messages.View_MissingMode(), "mode");
    }

    // create a view
    View v = all().findByName(mode).newInstance(req, req.getSubmittedForm());
    v.owner = owner;

    // redirect to the config screen
    rsp.sendRedirect2(req.getContextPath() + '/' + v.getUrl() + v.getPostConstructLandingPage());

    return v;
  }
Example #4
0
 /**
  * Deletes this item.
  * Note on the funny name: for reasons of historical compatibility, this URL is {@code /doDelete}
  * since it predates {@code <l:confirmationLink>}. {@code /delete} goes to a Jelly page
  * which should now be unused by core but is left in case plugins are still using it.
  */
 @CLIMethod(name="delete-job")
 @RequirePOST
 public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException {
     delete();
     if (rsp != null) // null for CLI
         rsp.sendRedirect2(req.getContextPath()+"/"+getParent().getUrl());
 }
 /**
  * Redirects the index page to the last result.
  *
  * @param request Stapler request
  * @param response Stapler response
  * @throws IOException in case of an error
  */
 public void doIndex(final StaplerRequest request, final StaplerResponse response)
     throws IOException {
   AbstractBuild<?, ?> build = getLastFinishedBuild();
   if (build != null) {
     response.sendRedirect2(String.format("../%d/%s", build.getNumber(), resultUrl));
   }
 }
  /** Web method to handle the approval action submitted by the user. */
  public void doApprove(
      StaplerRequest req,
      StaplerResponse rsp,
      @AncestorInPath PromotionProcess promotionProcess,
      @AncestorInPath AbstractBuild<?, ?> build)
      throws IOException, ServletException {

    JSONObject formData = req.getSubmittedForm();

    if (canApprove(promotionProcess, build)) {
      List<ParameterValue> paramValues = new ArrayList<ParameterValue>();

      if (parameterDefinitions != null && !parameterDefinitions.isEmpty()) {
        JSONArray a = JSONArray.fromObject(formData.get("parameter"));

        for (Object o : a) {
          JSONObject jo = (JSONObject) o;
          String name = jo.getString("name");

          ParameterDefinition d = getParameterDefinition(name);
          if (d == null)
            throw new IllegalArgumentException("No such parameter definition: " + name);

          paramValues.add(d.createValue(req, jo));
        }
      }
      approve(build, promotionProcess, paramValues);
    }

    rsp.sendRedirect2("../../../..");
  }
  public void doGraph(StaplerRequest req, StaplerResponse rsp) throws IOException {
    if (ChartUtil.awtProblemCause != null) {
      rsp.sendRedirect2(req.getContextPath() + DEFAULT_IMAGE);
      return;
    }

    getGraph().doPng(req, rsp);
  }
Example #8
0
  /** Deletes this view. */
  public synchronized void doDoDelete(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException {
    requirePOST();
    checkPermission(DELETE);

    owner.deleteView(this);

    rsp.sendRedirect2(req.getContextPath() + "/" + owner.getUrl());
  }
Example #9
0
  /**
   * Creates a {@link TopLevelItem} from the submission of the '/lib/hudson/newFromList/formList' or
   * throws an exception if it fails.
   */
  public synchronized TopLevelItem createTopLevelItem(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException {
    acl.checkPermission(Job.CREATE);

    TopLevelItem result;

    String requestContentType = req.getContentType();
    if (requestContentType == null) throw new Failure("No Content-Type header set");

    boolean isXmlSubmission =
        requestContentType.startsWith("application/xml")
            || requestContentType.startsWith("text/xml");

    String name = req.getParameter("name");
    if (name == null) throw new Failure("Query parameter 'name' is required");

    { // check if the name looks good
      Jenkins.checkGoodName(name);
      name = name.trim();
      if (parent.getItem(name) != null) throw new Failure(Messages.Hudson_JobAlreadyExists(name));
    }

    String mode = req.getParameter("mode");
    if (mode != null && mode.equals("copy")) {
      String from = req.getParameter("from");

      // resolve a name to Item
      Item src = null;
      if (!from.startsWith("/")) src = parent.getItem(from);
      if (src == null) src = Jenkins.getInstance().getItemByFullName(from);

      if (src == null) {
        if (Util.fixEmpty(from) == null) throw new Failure("Specify which job to copy");
        else throw new Failure("No such job: " + from);
      }
      if (!(src instanceof TopLevelItem)) throw new Failure(from + " cannot be copied");

      result = copy((TopLevelItem) src, name);
    } else {
      if (isXmlSubmission) {
        result = createProjectFromXML(name, req.getInputStream());
        rsp.setStatus(HttpServletResponse.SC_OK);
        return result;
      } else {
        if (mode == null) throw new Failure("No mode given");

        // create empty job and redirect to the project config screen
        result = createProject(Items.all().findByName(mode), name, true);
      }
    }

    rsp.sendRedirect2(redirectAfterCreateItem(req, result));
    return result;
  }
Example #10
0
  /** Debug command to attach to a running instance. */
  public void doAttach(StaplerRequest req, StaplerResponse rsp, @QueryParameter String id)
      throws ServletException, IOException, AmazonClientException {
    checkPermission(PROVISION);
    SlaveTemplate t = getTemplates().get(0);

    StringWriter sw = new StringWriter();
    StreamTaskListener listener = new StreamTaskListener(sw);
    EC2AbstractSlave node = t.attach(id, listener);
    Hudson.getInstance().addNode(node);

    rsp.sendRedirect2(req.getContextPath() + "/computer/" + node.getNodeName());
  }
  public void doRespondingTimeGraph(StaplerRequest request, StaplerResponse response)
      throws IOException {
    PerformanceReportPosition performanceReportPosition = new PerformanceReportPosition();
    request.bindParameters(performanceReportPosition);
    String performanceReportNameFile = performanceReportPosition.getPerformanceReportPosition();
    if (performanceReportNameFile == null) {
      if (getPerformanceReportList().size() == 1) {
        performanceReportNameFile = getPerformanceReportList().get(0);
      } else {
        return;
      }
    }
    if (ChartUtil.awtProblemCause != null) {
      // not available. send out error message
      response.sendRedirect2(request.getContextPath() + "/images/headless.png");
      return;
    }
    DataSetBuilder<String, NumberOnlyBuildLabel> dataSetBuilderAverage =
        new DataSetBuilder<String, NumberOnlyBuildLabel>();
    List<?> builds = getProject().getBuilds();
    List<Integer> buildsLimits = getFirstAndLastBuild(request, builds);

    int nbBuildsToAnalyze = builds.size();
    for (Iterator<?> iterator = builds.iterator(); iterator.hasNext(); ) {
      AbstractBuild<?, ?> currentBuild = (AbstractBuild<?, ?>) iterator.next();
      if (nbBuildsToAnalyze <= buildsLimits.get(1) && buildsLimits.get(0) <= nbBuildsToAnalyze) {
        NumberOnlyBuildLabel label = new NumberOnlyBuildLabel(currentBuild);
        PerformanceBuildAction performanceBuildAction =
            currentBuild.getAction(PerformanceBuildAction.class);
        if (performanceBuildAction == null) {
          continue;
        }
        PerformanceReport performanceReport =
            performanceBuildAction
                .getPerformanceReportMap()
                .getPerformanceReport(performanceReportNameFile);
        if (performanceReport == null) {
          nbBuildsToAnalyze--;
          continue;
        }
        dataSetBuilderAverage.add(
            performanceReport.getMedian(), Messages.ProjectAction_Median(), label);
        dataSetBuilderAverage.add(
            performanceReport.getAverage(), Messages.ProjectAction_Average(), label);
        dataSetBuilderAverage.add(
            performanceReport.get90Line(), Messages.ProjectAction_Line90(), label);
      }
      nbBuildsToAnalyze--;
    }
    ChartUtil.generateGraph(
        request, response, createRespondingTimeChart(dataSetBuilderAverage.build()), 400, 200);
  }
Example #12
0
  /** Deletes this user from Hudson. */
  public void doDoDelete(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException {
    requirePOST();
    checkPermission(Hudson.ADMINISTER);
    if (id.equals(Hudson.getAuthentication().getName())) {
      rsp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Cannot delete self");
      return;
    }

    delete();

    rsp.sendRedirect2("../..");
  }
  /** Generates the graph that shows the coverage trend up to this report. */
  public void doGraph(StaplerRequest req, StaplerResponse rsp) throws IOException {
    if (ChartUtil.awtProblemCause != null) {
      // not available. send out error message
      rsp.sendRedirect2(req.getContextPath() + "/images/headless.png");
      return;
    }

    Calendar t = owner.getTimestamp();

    if (req.checkIfModified(t, rsp)) {
      return; // up to date
    }
    JFreeChart chart = new CoverageChart(this).createChart();
    ChartUtil.generateGraph(req, rsp, chart, 500, 200);
  }
  /**
   * Returns the configured trend graph.
   *
   * @param request Stapler request
   * @param response Stapler response
   * @return the trend graph
   */
  public Graph getTrendGraph(final StaplerRequest request, final StaplerResponse response) {
    GraphConfigurationView configuration = createUserConfiguration(request);
    if (configuration.hasMeaningfulGraph()) {
      return configuration.getGraphRenderer(getUrlName());
    } else {
      BuildResultGraph graphType = configuration.getGraphType();
      try {
        response.sendRedirect2(request.getContextPath() + graphType.getExampleImage());
      } catch (IOException exception) {
        LOGGER.log(Level.SEVERE, "Can't create graph: " + graphType, exception);
      }

      return null;
    }
  }
  /**
   * @param req StaplerRequest
   * @param rsp StaplerResponse to redirect with
   * @throws IOException if redirection goes wrong
   */
  public void doCreate(StaplerRequest req, StaplerResponse rsp) throws Exception {
    validateAdmin();
    SeleniumGlobalConfiguration conf =
        req.bindJSON(SeleniumGlobalConfiguration.class, req.getSubmittedForm());
    if (null == conf.getName() || conf.getName().trim().equals("")) {
      throw new Failure("You must specify a name for the configuration");
    }

    if (PluginImpl.getPlugin().hasGlobalConfiguration(conf.getName())) {
      throw new Failure(
          "The configuration name you have chosen is already taken, please choose a unique name.");
    }

    PluginImpl.getPlugin().getGlobalConfigurations().add(conf);
    PluginImpl.getPlugin().save();
    rsp.sendRedirect2("configurations");
  }
Example #16
0
  /** Accepts the update to the node configuration. */
  @RequirePOST
  public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException, FormException {
    checkPermission(CONFIGURE);

    String name = Util.fixEmptyAndTrim(req.getSubmittedForm().getString("name"));
    Jenkins.checkGoodName(name);

    Node node = getNode();
    if (node == null) {
      throw new ServletException("No such node " + nodeName);
    }
    Node result = node.reconfigure(req, req.getSubmittedForm());
    replaceBy(result);

    // take the user back to the slave top page.
    rsp.sendRedirect2("../" + result.getNodeName() + '/');
  }
Example #17
0
  /**
   * Accepts submission from the configuration page.
   *
   * <p>Subtypes should override the {@link #submit(StaplerRequest)} method.
   */
  public final synchronized void doConfigSubmit(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException, FormException {
    checkPermission(CONFIGURE);
    requirePOST();

    submit(req);

    description = Util.nullify(req.getParameter("description"));
    filterExecutors = req.getParameter("filterExecutors") != null;
    filterQueue = req.getParameter("filterQueue") != null;

    rename(req.getParameter("name"));

    getProperties().rebuild(req, req.getSubmittedForm(), getApplicablePropertyDescriptors());

    save();

    rsp.sendRedirect2("../" + name);
  }
Example #18
0
  public static View create(StaplerRequest req, StaplerResponse rsp, ViewGroup owner)
      throws FormException, IOException, ServletException {
    String name = req.getParameter("name");
    checkGoodName(name);
    if (owner.getView(name) != null)
      throw new FormException(Messages.Hudson_ViewAlreadyExists(name), "name");

    String mode = req.getParameter("mode");
    if (mode == null || mode.length() == 0)
      throw new FormException(Messages.View_MissingMode(), "mode");

    // create a view
    View v = all().findByName(mode).newInstance(req, req.getSubmittedForm());
    v.owner = owner;

    // redirect to the config screen
    rsp.sendRedirect2(req.getContextPath() + '/' + v.getUrl() + v.getPostConstructLandingPage());

    return v;
  }
Example #19
0
  /** Renames this job. */
  @RequirePOST
  public /* not synchronized. see renameTo() */ void doDoRename(
      StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
    // rename is essentially delete followed by a create
    checkPermission(CREATE);
    checkPermission(DELETE);

    String newName = req.getParameter("newName");
    Jenkins.checkGoodName(newName);

    if (isBuilding()) {
      // redirect to page explaining that we can't rename now
      rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8"));
      return;
    }

    renameTo(newName);
    // send to the new job page
    // note we can't use getUrl() because that would pick up old name in the
    // Ancestor.getUrl()
    rsp.sendRedirect2("../" + newName);
  }
  public void doProvision(
      StaplerRequest req, StaplerResponse rsp, @QueryParameter String templateName)
      throws Exception {
    LOGGER.info("Azure Cloud: doProvision: start name = " + templateName);
    checkPermission(PROVISION);

    if (AzureUtil.isNull(templateName)) {
      sendError("Azure Cloud: doProvision: Azure Slave template name is missing", req, rsp);
      return;
    }

    final AzureSlaveTemplate slaveTemplate = getAzureSlaveTemplate(templateName);

    if (slaveTemplate == null) {
      sendError(
          "Azure Cloud: doProvision: Azure Slave template configuration is not there for  : "
              + templateName,
          req,
          rsp);
      return;
    }

    // 1. Verify template
    try {
      LOGGER.info(
          "Azure Cloud: doProvision: Verifying template " + slaveTemplate.getTemplateName());
      List<String> errors = slaveTemplate.verifyTemplate();

      if (errors.size() > 0) {
        LOGGER.info(
            "Azure Cloud: doProvision: template "
                + slaveTemplate.getTemplateName()
                + " has validation errors , cannot"
                + " provision slaves with this configuration "
                + errors);
        sendError(
            "template " + slaveTemplate.getTemplateName() + "has validation errors " + errors,
            req,
            rsp);
        return;
      } else {
        LOGGER.info(
            "Azure Cloud: provision: template "
                + slaveTemplate.getTemplateName()
                + "has no validation errors");
      }
    } catch (Exception e) {
      LOGGER.severe("Azure Cloud: provision: Exception occurred while validating template " + e);
      sendError("Exception occurred while validating template " + e);
      return;
    }

    LOGGER.severe("Azure Cloud: doProvision: creating slave ");
    Computer.threadPoolForRemoting.submit(
        new Callable<Node>() {

          public Node call() throws Exception {
            @SuppressWarnings("deprecation")
            AzureSlave slave = slaveTemplate.provisionSlave(new StreamTaskListener(System.out));
            // Get virtual machine properties
            LOGGER.info(
                "Azure Cloud: provision: Getting virtual machine properties for slave "
                    + slave.getNodeName()
                    + " with OS "
                    + slave.getOsType());
            slaveTemplate.setVirtualMachineDetails(slave);

            if (slave.getSlaveLaunchMethod().equalsIgnoreCase("SSH")) {
              slaveTemplate.waitForReadyRole(slave);
              LOGGER.info("Azure Cloud: provision: Waiting for ssh server to come up");
              Thread.sleep(2 * 60 * 1000);
              LOGGER.info("Azure Cloud: provision: ssh server may be up by this time");
              LOGGER.info("Azure Cloud: provision: Adding slave to azure nodes ");
              Hudson.getInstance().addNode(slave);
              slave.toComputer().connect(false).get();
            } else if (slave.getSlaveLaunchMethod().equalsIgnoreCase("JNLP")) {
              LOGGER.info("Azure Cloud: provision: Checking for slave status");
              slaveTemplate.waitForReadyRole(slave);
              Hudson.getInstance().addNode(slave);

              // Wait until node is online
              waitUntilOnline(slave);
            }
            return slave;
          }
        });
    rsp.sendRedirect2(req.getContextPath() + "/computer/");
    return;
  }
Example #21
0
 /** Delete all disabled modules. */
 public void doDoDeleteAllDisabledModules(StaplerResponse rsp)
     throws IOException, InterruptedException {
   checkPermission(DELETE);
   for (MavenModule m : getDisabledModules(true)) m.delete();
   rsp.sendRedirect2(".");
 }
Example #22
0
  /**
   * Serves a file from the file system (Maps the URL to a directory in a file system.)
   *
   * @param icon The icon file name, like "folder-open.gif"
   * @param serveDirIndex True to generate the directory index. False to serve "index.html"
   * @deprecated as of 1.297 Instead of calling this method explicitly, just return the {@link
   *     DirectoryBrowserSupport} object from the {@code doXYZ} method and let Stapler generate a
   *     response for you.
   */
  public void serveFile(
      StaplerRequest req, StaplerResponse rsp, FilePath root, String icon, boolean serveDirIndex)
      throws IOException, ServletException, InterruptedException {
    // handle form submission
    String pattern = req.getParameter("pattern");
    if (pattern == null) pattern = req.getParameter("path"); // compatibility with Hudson<1.129
    if (pattern != null) {
      rsp.sendRedirect2(pattern);
      return;
    }

    String path = getPath(req);
    if (path.replace('\\', '/').indexOf("/../") != -1) {
      // don't serve anything other than files in the artifacts dir
      rsp.sendError(HttpServletResponse.SC_BAD_REQUEST);
      return;
    }

    // split the path to the base directory portion "abc/def/ghi" which doesn't include any
    // wildcard,
    // and the GLOB portion "**/*.xml" (the rest)
    StringBuilder _base = new StringBuilder();
    StringBuilder _rest = new StringBuilder();
    int restSize = -1; // number of ".." needed to go back to the 'base' level.
    boolean zip = false; // if we are asked to serve a zip file bundle
    boolean plain = false; // if asked to serve a plain text directory listing
    {
      boolean inBase = true;
      StringTokenizer pathTokens = new StringTokenizer(path, "/");
      while (pathTokens.hasMoreTokens()) {
        String pathElement = pathTokens.nextToken();
        // Treat * and ? as wildcard unless they match a literal filename
        if ((pathElement.contains("?") || pathElement.contains("*"))
            && inBase
            && !(new FilePath(root, (_base.length() > 0 ? _base + "/" : "") + pathElement)
                .exists())) inBase = false;
        if (pathElement.equals("*zip*")) {
          // the expected syntax is foo/bar/*zip*/bar.zip
          // the last 'bar.zip' portion is to causes browses to set a good default file name.
          // so the 'rest' portion ends here.
          zip = true;
          break;
        }
        if (pathElement.equals("*plain*")) {
          plain = true;
          break;
        }

        StringBuilder sb = inBase ? _base : _rest;
        if (sb.length() > 0) sb.append('/');
        sb.append(pathElement);
        if (!inBase) restSize++;
      }
    }
    restSize = Math.max(restSize, 0);
    String base = _base.toString();
    String rest = _rest.toString();

    // this is the base file/directory
    FilePath baseFile = new FilePath(root, base);

    if (baseFile.isDirectory()) {
      if (zip) {
        rsp.setContentType("application/zip");
        baseFile.zip(rsp.getOutputStream(), rest);
        return;
      }
      if (plain) {
        rsp.setContentType("text/plain;charset=UTF-8");
        OutputStream os = rsp.getOutputStream();
        try {
          for (String kid : baseFile.act(new SimpleChildList())) {
            os.write(kid.getBytes("UTF-8"));
            os.write('\n');
          }
          os.flush();
        } finally {
          os.close();
        }
        return;
      }

      if (rest.length() == 0) {
        // if the target page to be displayed is a directory and the path doesn't end with '/',
        // redirect
        StringBuffer reqUrl = req.getRequestURL();
        if (reqUrl.charAt(reqUrl.length() - 1) != '/') {
          rsp.sendRedirect2(reqUrl.append('/').toString());
          return;
        }
      }

      FileCallable<List<List<Path>>> glob = null;

      if (rest.length() > 0) {
        // the rest is Ant glob pattern
        glob = new PatternScanner(rest, createBackRef(restSize));
      } else if (serveDirIndex) {
        // serve directory index
        glob = new ChildPathBuilder();
      }

      if (glob != null) {
        // serve glob
        req.setAttribute("it", this);
        List<Path> parentPaths = buildParentPath(base, restSize);
        req.setAttribute("parentPath", parentPaths);
        req.setAttribute("backPath", createBackRef(restSize));
        req.setAttribute("topPath", createBackRef(parentPaths.size() + restSize));
        req.setAttribute("files", baseFile.act(glob));
        req.setAttribute("icon", icon);
        req.setAttribute("path", path);
        req.setAttribute("pattern", rest);
        req.setAttribute("dir", baseFile);
        req.getView(this, "dir.jelly").forward(req, rsp);
        return;
      }

      // convert a directory service request to a single file service request by serving
      // 'index.html'
      baseFile = baseFile.child(indexFileName);
    }

    // serve a single file
    if (!baseFile.exists()) {
      rsp.sendError(HttpServletResponse.SC_NOT_FOUND);
      return;
    }

    boolean view = rest.equals("*view*");

    if (rest.equals("*fingerprint*")) {
      rsp.forward(Hudson.getInstance().getFingerprint(baseFile.digest()), "/", req);
      return;
    }

    ContentInfo ci = baseFile.act(new ContentInfo());

    if (LOGGER.isLoggable(Level.FINE))
      LOGGER.fine(
          "Serving "
              + baseFile
              + " with lastModified="
              + ci.lastModified
              + ", contentLength="
              + ci.contentLength);

    InputStream in = baseFile.read();
    if (view) {
      // for binary files, provide the file name for download
      rsp.setHeader("Content-Disposition", "inline; filename=" + baseFile.getName());

      // pseudo file name to let the Stapler set text/plain
      rsp.serveFile(req, in, ci.lastModified, -1, ci.contentLength, "plain.txt");
    } else {
      rsp.serveFile(req, in, ci.lastModified, -1, ci.contentLength, baseFile.getName());
    }
  }
 /**
  * @param req StaplerRequest
  * @param rsp StaplerResponse to redirect with
  * @throws IOException if redirection goes wrong
  */
 public void doAddRedirect(StaplerRequest req, StaplerResponse rsp) throws IOException {
   validateAdmin();
   rsp.sendRedirect2("add");
 }
Example #24
0
 /** Returns the image that shows the current buildCommand status. */
 public void doBuildStatus(StaplerRequest req, StaplerResponse rsp) throws IOException {
   rsp.sendRedirect2(req.getContextPath() + "/images/48x48/" + getBuildStatusUrl());
 }