@Override public Resource getResource(final String path) throws IOException { String modPath = path; if(modPath.startsWith("/")) { modPath = path.substring(1); } final String realPath = prefix + modPath; final URL resource = classLoader.getResource(realPath); if(resource == null) { return null; } else { return new URLResource(resource, path); } }
@Override public List<Resource> list() { List<Resource> result = new LinkedList<>(); Path file = getFilePath(); try { if (file != null) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(file)) { for (Path child : stream) { result.add(new URLResource(child.toUri().toURL(), child.toString())); } } } } catch (IOException e) { throw new RuntimeException(e); } return result; }
@Override public Resource getResource(String path) throws IOException { URL url = new URL("jar:file:" + this.jarPath + "!" + (path.startsWith("/") ? path : "/" + path)); URLResource resource = new URLResource(url, path); if (resource.getContentLength() < 0) { return null; } return resource; }
private URLResource getMetaInfResource(URL resourceJar, String path) { try { URL resourceUrl = new URL(resourceJar + "META-INF/resources" + path); URLResource resource = new URLResource(resourceUrl, path); if (resource.getContentLength() < 0) { return null; } return resource; } catch (MalformedURLException ex) { return null; } }
@Override public Resource getResource(final String path) throws IOException { String modPath = path; if(modPath.startsWith("/")) { modPath = path.substring(1); } final String realPath = prefix + modPath; final URL resource = classLoader.getResource(realPath); if(resource == null) { return null; } else { return new URLResource(resource, path); } }
@Override public Resource getResource(final String path) throws IOException { String modPath = path; if(modPath.startsWith("/")) { modPath = path.substring(1); } final String realPath = prefix + modPath; final URL resource = classLoader.getResource(realPath); if(resource == null) { return null; } else { return new URLResource(resource, path); } }
@Override public List<Resource> list() { List<Resource> result = new LinkedList<>(); Path file = getFilePath(); try { if (file != null) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(file)) { for (Path child : stream) { result.add(new URLResource(child.toUri().toURL(), child.toString())); } } } } catch (IOException e) { throw new RuntimeException(e); } return result; }
@Override public List<Resource> list() { List<Resource> result = new LinkedList<>(); Path file = getFilePath(); try { if (file != null) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(file)) { for (Path child : stream) { result.add(new URLResource(child.toUri().toURL(), child.toString())); } } } } catch (IOException e) { throw new RuntimeException(e); } return result; }
@Override public UndertowResponse send(URL url) { Resource resource = new URLResource(url, ""); resource.serve(sender(), hse, IoCallback.END_EXCHANGE); return me(); }
@Override public UndertowResponse send(URL url) { Resource resource = new URLResource(url, ""); resource.serve(sender(), hse, IoCallback.END_EXCHANGE); return me(); }