Java Code Examples for org.kohsuke.stapler.StaplerRequest#checkIfModified()

The following examples show how to use org.kohsuke.stapler.StaplerRequest#checkIfModified() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AWSDeviceFarmTestResult.java    From aws-device-farm-jenkins-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 2
Source File: AWSDeviceFarmTestResult.java    From aws-device-farm-jenkins-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: AbstractTestResultAction.java    From junit-plugin with MIT License 5 votes vote down vote up
/**
 * 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;
    }

    if(req.checkIfModified(run.getTimestamp(),rsp))
        return;

    ChartUtil.generateGraph(req,rsp,createChart(req,buildDataSet(req)),calcDefaultSize());
}
 
Example 4
Source File: AbstractTestResultAction.java    From junit-plugin with MIT License 4 votes vote down vote up
/**
 * Generates a clickable map HTML for {@link #doGraph(StaplerRequest, StaplerResponse)}.
 */
public void doGraphMap( StaplerRequest req, StaplerResponse rsp) throws IOException {
    if(req.checkIfModified(run.getTimestamp(),rsp))
        return;
    ChartUtil.generateClickableMap(req,rsp,createChart(req,buildDataSet(req)),calcDefaultSize());
}