本文整理汇总了Java中org.kohsuke.stapler.StaplerResponse.sendRedirect2方法的典型用法代码示例。如果您正苦于以下问题:Java StaplerResponse.sendRedirect2方法的具体用法?Java StaplerResponse.sendRedirect2怎么用?Java StaplerResponse.sendRedirect2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kohsuke.stapler.StaplerResponse
的用法示例。
在下文中一共展示了StaplerResponse.sendRedirect2方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doEndOfflineAgentJobs
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doEndOfflineAgentJobs(final StaplerRequest request, final StaplerResponse response) {
Jenkins j;
if ((j = Jenkins.getInstance()) != null) {
Queue queue = j.getQueue();
if (queue != null) {
for (Item job : queue.getItems()) {
if (job.getCauseOfBlockage() instanceof BecauseNodeIsOffline
|| job.getCauseOfBlockage() instanceof BecauseLabelIsOffline) {
queue.cancel(job);
}
}
}
}
try {
response.sendRedirect2(request.getRootPath());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例2: plotGraph
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* Generates and writes the plotpipeline to the response output stream.
*
* @param req
* the incoming request
* @param rsp
* the response stream
* @throws IOException
*/
public void plotGraph(StaplerRequest req, StaplerResponse rsp)
throws IOException {
if ( ChartUtil.awtProblemCause != null) {
// Not available. Send out error message.
rsp.sendRedirect2(req.getContextPath() + "/images/headless.png");
return;
}
setWidth(req);
setHeight(req);
setNumBuilds(req);
setRightBuildNum(req);
setHasLegend(req);
setTitle(req);
setStyle(req);
setUseDescr(req);
// need to force regenerate the plotpipeline in case build
// descriptions (used for tool tips) have changed
generatePlot(true);
ChartUtil.generateGraph(req, rsp, plot, getWidth(), getHeight());
}
示例3: plotGraphMap
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* Generates and writes the plotpipeline's clickable map to the response output
* stream.
*
* @param req
* the incoming request
* @param rsp
* the response stream
* @throws IOException
*/
public void plotGraphMap(StaplerRequest req, StaplerResponse rsp)
throws IOException {
if ( ChartUtil.awtProblemCause != null) {
// not available. send out error message
rsp.sendRedirect2(req.getContextPath() + "/images/headless.png");
return;
}
setWidth(req);
setHeight(req);
setNumBuilds(req);
setRightBuildNum(req);
setHasLegend(req);
setTitle(req);
setStyle(req);
setUseDescr(req);
generatePlot(false);
ChartRenderingInfo info = new ChartRenderingInfo();
plot.createBufferedImage(getWidth(), getHeight(), info);
rsp.setContentType("text/plain;charset=UTF-8");
rsp.getWriter().println(
ChartUtilities.getImageMap(getCsvFileName(), info));
}
示例4: doTestSubmitBuildRef
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* A stub method, which emulates the submission of the image reference
* from the web interface
* @param req Incoming request
* @param rsp Response
* @param imageId image id
* @param jobName job name, to which the facet should be attached
* @throws IOException Request processing error
* @throws ServletException Servlet error
*/
public static void doTestSubmitBuildRef(StaplerRequest req, StaplerResponse rsp,
@QueryParameter(required = true) String imageId,
@QueryParameter(required = true) String jobName) throws IOException, ServletException {
final Jenkins j = Jenkins.getInstance();
if (j == null) {
throw new IOException("Jenkins instance is not active");
}
j.checkPermission(Jenkins.ADMINISTER);
final AbstractProject item = j.getItem(jobName, j, AbstractProject.class);
final Run latest = item != null ? item.getLastBuild() : null;
if (latest == null) {
throw new IOException("Cannot find a project or run to modify");
}
DockerFingerprints.addFromFacet(null,imageId, latest);
rsp.sendRedirect2(j.getRootUrl());
}
示例5: doGraph
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* Return trend graph of all AWS Device Farm results for this project.
*
* @param request The request object.
* @param response The response object.
* @throws IOException
*/
@SuppressWarnings("unused")
public void doGraph(StaplerRequest request, StaplerResponse response) throws IOException {
// Abort if having Java AWT issues.
if (ChartUtil.awtProblemCause != null) {
response.sendRedirect2(String.format("%s/images/headless.png", request.getContextPath()));
return;
}
// Get previous AWS Device Farm build and results.
AWSDeviceFarmTestResultAction prev = getLastBuildAction();
if (prev == null) {
return;
}
AWSDeviceFarmTestResult result = prev.getResult();
if (result == null) {
return;
}
// Create new graph for the AWS Device Farm results of all runs in this project.
Graph graph = AWSDeviceFarmGraph.createResultTrendGraph(prev.getOwner(), false, result.getPreviousResults());
graph.doPng(request, response);
}
示例6: doGraph
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* Create the graph image for the number of pass/warn/fail results in a test run, for the previous three Jenkins runs.
*
* @param request
* @param response
* @throws IOException
*/
@SuppressWarnings("unused")
public void doGraph(StaplerRequest request, StaplerResponse response) throws IOException {
// Abort if having Java AWT issues.
if (ChartUtil.awtProblemCause != null) {
response.sendRedirect2(String.format("%s/images/headless.png", request.getContextPath()));
return;
}
// Check the "If-Modified-Since" header and abort if we don't need re-create the graph.
if (isCompleted()) {
Calendar timestamp = getOwner().getTimestamp();
if (request.checkIfModified(timestamp, response)) {
return;
}
}
// Create new graph for this AWS Device Farm result.
Graph graph = AWSDeviceFarmGraph.createResultTrendGraph(build, isCompleted(), getPreviousResults(DefaultTrendGraphSize));
graph.doPng(request, response);
}
示例7: doDurationGraph
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* Create the graph image for the number of device minutes used in a test run, for the previous three Jenkins runs.
*
* @param request
* @param response
* @throws IOException
*/
@SuppressWarnings("unused")
public void doDurationGraph(StaplerRequest request, StaplerResponse response) throws IOException {
// Abort if having Java AWT issues.
if (ChartUtil.awtProblemCause != null) {
response.sendRedirect2(String.format("%s/images/headless.png", request.getContextPath()));
return;
}
// Check the "If-Modified-Since" header and abort if we don't need re-create the graph.
if (isCompleted()) {
Calendar timestamp = getOwner().getTimestamp();
if (request.checkIfModified(timestamp, response)) {
return;
}
}
// Create new duration graph for this AWS Device Farm result.
Graph graph = AWSDeviceFarmGraph.createDurationTrendGraph(build, isCompleted(), getPreviousResults(DefaultTrendGraphSize));
graph.doPng(request, response);
}
示例8: doGraph
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* Generates a PNG image for the test result trend.
*/
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;
}
CxScanResult cxScanResult = getLastSynchronousBuildAction();
if (cxScanResult != null && req.checkIfModified(cxScanResult.owner.getTimestamp(), rsp)) {
return;
}
ChartUtil.generateGraph(req, rsp, createChart(req, buildDataSet(req)), calcDefaultSize());
}
示例9: doAttach
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* 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());
}
示例10: doCoverageGraph
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doCoverageGraph(StaplerRequest req, StaplerResponse rsp) throws IOException {
CategoryDataset coverageDataset = this.doStats();
this.setCategoryDataset(coverageDataset);
if (ChartUtil.awtProblemCause != null) {
rsp.sendRedirect2(req.getContextPath());
} else {
this.doPng(req, rsp);
}
}
示例11: doTimeGraph
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doTimeGraph(StaplerRequest req, StaplerResponse rsp) throws IOException {
CategoryDataset timeDataset = this.doStats();
this.setCategoryDataset(timeDataset);
if (ChartUtil.awtProblemCause != null) {
rsp.sendRedirect2(req.getContextPath());
} else {
this.doPng(req, rsp);
}
}
示例12: doContainer
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* Gets a container {@link Fingerprint} page.
* @param req Stapler request
* @param rsp Stapler response
* @param id Container ID. Method supports full 64-char IDs only.
* @throws IOException Request processing error
* @throws ServletException Servlet error
*/
public void doContainer(StaplerRequest req, StaplerResponse rsp,
@QueryParameter(required = true) String id)
throws IOException, ServletException {
checkPermission(Jenkins.READ);
Jenkins j = Jenkins.getInstance();
if (j == null) {
rsp.sendError(500, "Jenkins is not ready");
return;
}
String fingerPrintHash = DockerTraceabilityHelper.getContainerHash(id);
rsp.sendRedirect2(j.getRootUrl()+"fingerprint/"+fingerPrintHash);
}
示例13: doImage
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* Gets an image {@link Fingerprint} page.
* @param req Stapler request
* @param rsp Stapler response
* @param id Image ID. Method supports full 64-char IDs only.
* @throws IOException Request processing error
* @throws ServletException Servlet error
*/
public void doImage(StaplerRequest req, StaplerResponse rsp,
@QueryParameter(required = true) String id)
throws IOException, ServletException {
checkPermission(Jenkins.READ);
Jenkins j = Jenkins.getInstance();
if (j == null) {
rsp.sendError(500, "Jenkins is not ready");
return;
}
String fingerPrintHash = DockerTraceabilityHelper.getImageHash(id);
rsp.sendRedirect2(j.getRootUrl()+"fingerprint/"+fingerPrintHash);
}
示例14: doIndex
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
* Serve up AWS Device Farm project page which redirects to the latest test results or 404.
*
* @param request The request object.
* @param response The response object.
* @throws IOException
*/
@SuppressWarnings("unused")
public void doIndex(StaplerRequest request, StaplerResponse response) throws IOException {
AbstractBuild<?, ?> prev = AWSDeviceFarmUtils.previousAWSDeviceFarmBuild(project);
if (prev == null) {
response.sendRedirect2("404");
} else {
// Redirect to build page of most recent AWS Device Farm test run.
response.sendRedirect2(String.format("../%d/%s", prev.getNumber(), getUrlName()));
}
}
示例15: doDoDelete
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/** Perform the deletion. */
@RequirePOST
@Override
public synchronized void doDoDelete(StaplerRequest req, StaplerResponse rsp)
throws IOException, ServletException, InterruptedException {
delete();
rsp.sendRedirect2(Joiner.on("/").join(
req.getContextPath(), getParent().getUrl()));
}