List of utility methods to do ClassLoader Load
String | getSystemPath(String inPath) get System Path return getUrl(inPath).toString().replace(getUrl(inPath).getProtocol() + ":/", ""); |
File | getTestDir(final String name) get Test Dir ClassLoader cloader = Thread.currentThread().getContextClassLoader(); URL resource = cloader.getResource(name); if (resource == null) { throw new IOException("Cannot find test directory: " + name); return new File(new URI(resource.toExternalForm()).normalize().getPath()); |
String | getTestJson() get Test Json try { URL url = Thread.currentThread().getContextClassLoader().getResource("model.json"); File file = new File(url.getPath()); return readFile(file); } catch (IOException ex) { throw new RuntimeException("Unable to load test file : " + ex.getMessage()); |
URL | getTomcatBinaryDistribution() Returns URL to get Tomcat binary distribution. URL tomcatDistributionUrl = Thread.currentThread().getContextClassLoader().getResource("sdk-tomcat.zip"); if (tomcatDistributionUrl == null) { throw new IOException("Unable to get Tomcat binary distribution."); return tomcatDistributionUrl; |
File | getVolFile(String fileName) get Vol File URL validURL = ClassLoader.getSystemResource(fileName); return new File(validURL.toURI()); |