static Resource fromURL(URL url) throws IOException { return fromURL(url, null); }
static Resource fromURL(URL url) throws IOException { return fromURL(url, null); }
public Jar getValidJar(URL url) throws Exception { try (Resource resource = Resource.fromURL(url, getPlugin(HttpClient.class))) { Jar jar = Jar.fromResource(url.getFile() .replace('/', '.'), resource); return getValidJar(jar, url.toString()); } }
public Jar getValidJar(URL url) throws Exception { try (Resource resource = Resource.fromURL(url, getPlugin(HttpClient.class))) { Jar jar = Jar.fromResource(url.getFile() .replace('/', '.'), resource); return getValidJar(jar, url.toString()); } }
public BundleBuilder addResource(String path, URL url) throws IOException { return addResource(path, Resource.fromURL(url, getPlugin(HttpClient.class))); }
public BundleBuilder addResource(String path, URL url) throws IOException { return addResource(path, Resource.fromURL(url, getPlugin(HttpClient.class))); }
@Override public Resource make(Builder builder, String destination, Map<String, String> argumentsOnMake) throws Exception { String type = argumentsOnMake.get("type"); if (!type.equals("copy")) return null; String from = argumentsOnMake.get("from"); if (from == null) { String content = argumentsOnMake.get("content"); if (content == null) throw new IllegalArgumentException("No 'from' or 'content' field in copy " + argumentsOnMake); return new EmbeddedResource(content, 0L); } File f = builder.getFile(from); if (f.isFile()) return new FileResource(f); try { URL url = new URL(from); return Resource.fromURL(url, builder.getPlugin(HttpClient.class)); } catch (MalformedURLException mfue) { // We ignore this } throw new IllegalArgumentException("Copy source does not exist " + from + " for destination " + destination); }
@Override public Resource make(Builder builder, String destination, Map<String, String> argumentsOnMake) throws Exception { String type = argumentsOnMake.get("type"); if (!type.equals("copy")) return null; String from = argumentsOnMake.get("from"); if (from == null) { String content = argumentsOnMake.get("content"); if (content == null) throw new IllegalArgumentException("No 'from' or 'content' field in copy " + argumentsOnMake); return new EmbeddedResource(content, 0L); } File f = builder.getFile(from); if (f.isFile()) return new FileResource(f); try { URL url = new URL(from); return Resource.fromURL(url, builder.getPlugin(HttpClient.class)); } catch (MalformedURLException mfue) { // We ignore this } throw new IllegalArgumentException("Copy source does not exist " + from + " for destination " + destination); }
/** * Find a clazz on the class path. This class has been parsed. */ public Clazz findClass(TypeRef typeRef) throws Exception { Clazz c = classspace.get(typeRef); if (c != null) return c; c = importedClassesCache.get(typeRef); if (c != null) return c; Resource r = findResource(typeRef.getPath()); if (r == null) { getClass().getClassLoader(); URL url = ClassLoader.getSystemResource(typeRef.getPath()); if (url != null) r = Resource.fromURL(url, getPlugin(HttpClient.class)); } if (r != null) { c = new Clazz(this, typeRef.getPath(), r); c.parseClassFile(); importedClassesCache.put(typeRef, c); } return c; }
/** * Find a clazz on the class path. This class has been parsed. */ public Clazz findClass(TypeRef typeRef) throws Exception { Clazz c = classspace.get(typeRef); if (c != null) return c; c = importedClassesCache.get(typeRef); if (c != null) return c; Resource r = findResource(typeRef.getPath()); if (r == null) { getClass().getClassLoader(); URL url = ClassLoader.getSystemResource(typeRef.getPath()); if (url != null) r = Resource.fromURL(url, getPlugin(HttpClient.class)); } if (r != null) { c = new Clazz(this, typeRef.getPath(), r); c.parseClassFile(); importedClassesCache.put(typeRef, c); } return c; }
try (Resource resource = Resource.fromURL(url, getPlugin(HttpClient.class))) { Jar jar = Jar.fromResource(fileName(url.getPath()), resource); if (jar.lastModified() <= 0L) {
try (Resource resource = Resource.fromURL(url, getPlugin(HttpClient.class))) { try (OutputStream out = IO.outputStream(tmp)) { resource.write(out);
try (Resource resource = Resource.fromURL(url, getPlugin(HttpClient.class))) { try (OutputStream out = IO.outputStream(tmp)) { resource.write(out);
try (Resource resource = Resource.fromURL(url, getPlugin(HttpClient.class))) { Jar jar = Jar.fromResource(fileName(url.getPath()), resource); if (jar.lastModified() <= 0L) {
try (Resource resource = Resource.fromURL(u, client)) { try (OutputStream out = IO.outputStream(f)) { resource.write(out);
try (Resource resource = Resource.fromURL(u, client)) { try (OutputStream out = IO.outputStream(f)) { resource.write(out);