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); }
@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); } }
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); }
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); }
/** * 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); }
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; }
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); } }
public DirectoryBrowserSupport doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException { return new DirectoryBrowserSupport(this, buildPath.child(getUrlName()), "Scoverage HTML Report", "", false); }
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); }