Java 类hudson.model.DirectoryBrowserSupport 实例源码

项目:donut-jenkins-plugin    文件:DonutAction.java   
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
    // Relax the Content Security Policy
    System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "");
    System.setProperty("jenkins.model.DirectoryBrowserSupport.CSP", "");

    DirectoryBrowserSupport dbs = new DirectoryBrowserSupport(this, new FilePath(this.dir()), this.getTitle(), getUrlName(), false);
    File report = new File(dir(), DONUT_REPORT_FILENAME);

    if (!report.exists()) {
        rsp.sendRedirect(Functions.getResourcePath() + "/plugin/donut-jenkins-plugin/error.html");
        return;
    }

    dbs.setIndexFileName(DONUT_REPORT_FILENAME);
    dbs.generateResponse(req, rsp, this);
}
项目:external-workspace-manager-plugin    文件:ExternalWorkspace.java   
@Restricted(NoExternalUse.class)
@SuppressWarnings("unused")
public DirectoryBrowserSupport doWs(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException {
    FilePath ws = new FilePath(new File(masterMountPoint, pathOnDisk));
    if (!ws.exists()) {
        req.getView(this, "noWorkspace.jelly").forward(req, rsp);
        return null;
    } else {
        return new DirectoryBrowserSupport(this, ws, getDisplayName(), "folder.png", true);
    }
}
项目:cucumber-living-documentation-plugin    文件:CukedoctorBaseAction.java   
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
    System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "");
    DirectoryBrowserSupport dbs = new DirectoryBrowserSupport(this, new FilePath(dir()), getTitle(), getUrlName(),
            false);

    dbs.setIndexFileName(documentationPage);
    dbs.generateResponse(req, rsp, this);
}
项目:golang-coverage-report    文件:GolangCoverageReportBuildAction.java   
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException,
    ServletException {
    // since Jenkins blocks JavaScript as described at
    // https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy and fact that plugin uses JS
    // to display charts, following must be applied
    System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "");

    DirectoryBrowserSupport
        dbs = new DirectoryBrowserSupport(this, new FilePath(dir()), getTitle(), getUrlName(),
        false);

    dbs.setIndexFileName(DEFAULT_URL);
    dbs.generateResponse(req, rsp, this);
}
项目:Spirent-iTest-Jenkins-Plugin    文件:Report.java   
/**
 * Serves HTML reports.
 */
public void doDynamic(StaplerRequest req, StaplerResponse rsp) 
        throws IOException, ServletException {
    DirectoryBrowserSupport dbs = new DirectoryBrowserSupport(
            this, new FilePath(this.dir()), this.getTitle(), 
            "/plugin/itest/images/24x24/Spirent_favicon.ico", false);
 // Hudson >= 1.312
    dbs.setIndexFileName(Report.this.wrapperName); 
    dbs.generateResponse(req, rsp, this);
}
项目:scoverage-plugin    文件:ScoverageProjectAction.java   
public DirectoryBrowserSupport doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException {
    if (job.getLastBuild() != null && getDisplayName() != null) {
        ScoverageBuildAction lastSuccessfulAction = getLastSuccessfulBuildAction();

        if (lastSuccessfulAction != null) {
            String url = lastSuccessfulAction.getUrlName();
            FilePath path = new FilePath(job.getLastBuild().getRootDir()).child(url);

        return new DirectoryBrowserSupport(this, path, "Scoverage HTML Report", "", false);
        }
    }

    return null;
}
项目:cucumber-reports-plugin    文件:SafeArchiveServingAction.java   
private HttpResponse serveFile(File file) throws IOException, ServletException {
    if (CollectionUtils.isEmpty(safeDirectories)) {
        // this is to keep compatibility with older reports for which the collection might not be initiated
        return new UnsafeDirectoryBrowserSupport(file);
    } else if (safeDirectories.contains(file.getParentFile())) {
        // Reports in safe directories can be trusted and must be served
        // without Content-Security-Policy to display reports properly
        return new UnsafeDirectoryBrowserSupport(file);
    } else {
        // Other can (such as embeddings) can not be trusted,and must
        // be served with Content-Security-Policy
        return new DirectoryBrowserSupport(this, new FilePath(rootDir), title, iconName, false);
    }
}
项目:scoverage-plugin    文件:ScoverageBuildAction.java   
public DirectoryBrowserSupport doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException {
    return new DirectoryBrowserSupport(this, buildPath.child(getUrlName()), "Scoverage HTML Report", "", false);
}
项目:sahagin-jenkins-plugin    文件:SahaginReportAction.java   
public DirectoryBrowserSupport doDynamic(StaplerRequest req, StaplerResponse res) throws IOException {
    FilePath buildReportDir = new FilePath(new File(build.getRootDir(), buildReportDirName));
    return new DirectoryBrowserSupport(this, buildReportDir, getDisplayName(), null, false);
}