/** * Convenience constructor. * @param u the URL to expose. */ public URLResource(URL u) { setURL(u); }
/** * Convenience constructor. * @param u holds the URL to expose. */ public URLResource(URLProvider u) { setURL(u.getURL()); }
/** * Set the URL from a File. * @param f the File to set as a URL. */ public synchronized void setFile(File f) { try { setURL(FILE_UTILS.getFileURL(f)); } catch (MalformedURLException e) { throw new BuildException(e); } }
/** * Access the stylesheet to be used as a resource. * * @return stylesheet as a resource */ @Override protected Resource getStylesheet() { String xslname = "junit-frames.xsl"; if (NOFRAMES.equals(format)) xslname = "junit-noframes.xsl"; if (styleDir == null) { URLResource stylesheet = new URLResource(); URL stylesheetURL = getClass().getClassLoader().getResource(concat(XSL_FILE_PATH, xslname)); stylesheet.setURL(stylesheetURL); return stylesheet; } FileResource stylesheet = new FileResource(); File stylesheetFile = new File(styleDir, xslname); stylesheet.setFile(stylesheetFile); return stylesheet; }
/** * Access the stylesheet to be used as a resource. * * @return stylesheet as a resource */ @Override protected Resource getStylesheet() { String xslname = "junit-frames.xsl"; if (NOFRAMES.equals(format)) xslname = "junit-noframes.xsl"; if (styleDir == null) { URLResource stylesheet = new URLResource(); URL stylesheetURL = getClass().getClassLoader().getResource(concat(XSL_FILE_PATH, xslname)); stylesheet.setURL(stylesheetURL); return stylesheet; } FileResource stylesheet = new FileResource(); File stylesheetFile = new File(styleDir, xslname); stylesheet.setFile(stylesheetFile); return stylesheet; }