/** * @param resource Comma or semicolon separated path of filenames or URLs * pointing to directories or jar files. Directories should end * with '/'. * @throws IOException if unable to add classpath from resource */ public void addClassPath(Resource resource) throws IOException { if (resource instanceof ResourceCollection) { for (Resource r : ((ResourceCollection)resource).getResources()) addClassPath(r); } else { addClassPath(resource.toString()); } }
@Override public URL getResource(String path) throws MalformedURLException { Resource resource=WebAppContext.this.getResource(path); if (resource==null || !resource.exists()) return null; // Should we go to the original war? if (resource.isDirectory() && resource instanceof ResourceCollection && !WebAppContext.this.isExtractWAR()) { Resource[] resources = ((ResourceCollection)resource).getResources(); for (int i=resources.length;i-->0;) { if (resources[i].getName().startsWith("jar:file")) return resources[i].getURI().toURL(); } } return resource.getURI().toURL(); }
/** * Instantiates a new resource collection. * * @param resources the resources to be added to collection */ public ResourceCollection(Resource... resources) { List<Resource> list = new ArrayList<Resource>(); for (Resource r : resources) { if (r==null) continue; if (r instanceof ResourceCollection) { for (Resource r2 : ((ResourceCollection)r).getResources()) list.add(r2); } else list.add(r); } _resources = list.toArray(new Resource[list.size()]); for(Resource r : _resources) { if(!r.exists() || !r.isDirectory()) throw new IllegalArgumentException(r + " is not an existing directory."); } }
Resource r = resourceResolver.getResource("/content/dam/collections/m/fafdsfdaf/my_collection"); ResourceCollection collection = r.adaptTo(ResourceCollection.class); Iterator<Resource> it = collection.getResources(); while(it.hasNext()) { Resource p = it.next(); %><%= p.getPath() %><% }
/** * Instantiates a new resource collection. * * @param resources the resources to be added to collection */ public ResourceCollection(Resource... resources) { List<Resource> list = new ArrayList<Resource>(); for (Resource r : resources) { if (r==null) continue; if (r instanceof ResourceCollection) { for (Resource r2 : ((ResourceCollection)r).getResources()) list.add(r2); } else list.add(r); } _resources = list.toArray(new Resource[list.size()]); for(Resource r : _resources) { if(!r.exists() || !r.isDirectory()) throw new IllegalArgumentException(r + " is not an existing directory."); } }
/** * Instantiates a new resource collection. * * @param resources the resources to be added to collection */ public ResourceCollection(Resource... resources) { List<Resource> list = new ArrayList<Resource>(); for (Resource r : resources) { if (r==null) continue; if (r instanceof ResourceCollection) { for (Resource r2 : ((ResourceCollection)r).getResources()) list.add(r2); } else list.add(r); } _resources = list.toArray(new Resource[list.size()]); for(Resource r : _resources) { if(!r.exists() || !r.isDirectory()) throw new IllegalArgumentException(r + " is not an existing directory."); } }
/** * Instantiates a new resource collection. * * @param resources the resources to be added to collection */ public ResourceCollection(Resource... resources) { List<Resource> list = new ArrayList<Resource>(); for (Resource r : resources) { if (r==null) continue; if (r instanceof ResourceCollection) { for (Resource r2 : ((ResourceCollection)r).getResources()) list.add(r2); } else list.add(r); } _resources = list.toArray(new Resource[list.size()]); for(Resource r : _resources) { if(!r.exists() || !r.isDirectory()) throw new IllegalArgumentException(r + " is not an existing directory."); } }
/** * @param resource Comma or semicolon separated path of filenames or URLs * pointing to directories or jar files. Directories should end * with '/'. */ public void addClassPath(Resource resource) throws IOException { if (resource instanceof ResourceCollection) { for (Resource r : ((ResourceCollection)resource).getResources()) addClassPath(r); } else { addClassPath(resource.toString()); } }
/** * @param resource Comma or semicolon separated path of filenames or URLs * pointing to directories or jar files. Directories should end * with '/'. */ public void addClassPath(Resource resource) throws IOException { if (resource instanceof ResourceCollection) { for (Resource r : ((ResourceCollection)resource).getResources()) addClassPath(r); } else { addClassPath(resource.toString()); } }
/** * @param resource Comma or semicolon separated path of filenames or URLs * pointing to directories or jar files. Directories should end * with '/'. */ public void addClassPath(Resource resource) throws IOException { if (resource instanceof ResourceCollection) { for (Resource r : ((ResourceCollection)resource).getResources()) addClassPath(r); } else { addClassPath(resource.toString()); } }
/** * @param resource Comma or semicolon separated path of filenames or URLs * pointing to directories or jar files. Directories should end * with '/'. */ public void addClassPath(Resource resource) throws IOException { if (resource instanceof ResourceCollection) { for (Resource r : ((ResourceCollection)resource).getResources()) addClassPath(r); } else { addClassPath(resource.toString()); } }
/** * @param resource Comma or semicolon separated path of filenames or URLs * pointing to directories or jar files. Directories should end * with '/'. * @throws IOException if unable to add classpath from resource */ public void addClassPath(Resource resource) throws IOException { if (resource instanceof ResourceCollection) { for (Resource r : ((ResourceCollection)resource).getResources()) addClassPath(r); } else { addClassPath(resource.toString()); } }
/** * @param resource Comma or semicolon separated path of filenames or URLs * pointing to directories or jar files. Directories should end * with '/'. */ public void addClassPath(Resource resource) throws IOException { if (resource instanceof ResourceCollection) { for (Resource r : ((ResourceCollection)resource).getResources()) addClassPath(r); } else { addClassPath(resource.toString()); } }
public void addClassPath(Resource resource) throws IOException { if (resource instanceof ResourceCollection) { for (Resource r : ((ResourceCollection)resource).getResources()) addClassPath(r); } else { addClassPath(resource.getFile().getAbsolutePath()); } }
@Override public URL getResource(String path) throws MalformedURLException { Resource resource=WebAppContext.this.getResource(path); if (resource==null || !resource.exists()) return null; // Should we go to the original war? if (resource.isDirectory() && resource instanceof ResourceCollection && !WebAppContext.this.isExtractWAR()) { Resource[] resources = ((ResourceCollection)resource).getResources(); for (int i=resources.length;i-->0;) { if (resources[i].getName().startsWith("jar:file")) return resources[i].getURI().toURL(); } } return resource.getURI().toURL(); }
@Override public URL getResource(String path) throws MalformedURLException { Resource resource=WebAppContext.this.getResource(path); if (resource==null || !resource.exists()) return null; // Should we go to the original war? if (resource.isDirectory() && resource instanceof ResourceCollection && !WebAppContext.this.isExtractWAR()) { Resource[] resources = ((ResourceCollection)resource).getResources(); for (int i=resources.length;i-->0;) { if (resources[i].getName().startsWith("jar:file")) return resources[i].getURL(); } } return resource.getURL(); }
@Override public URL getResource(String path) throws MalformedURLException { Resource resource=WebAppContext.this.getResource(path); if (resource==null || !resource.exists()) return null; // Should we go to the original war? if (resource.isDirectory() && resource instanceof ResourceCollection && !WebAppContext.this.isExtractWAR()) { Resource[] resources = ((ResourceCollection)resource).getResources(); for (int i=resources.length;i-->0;) { if (resources[i].getName().startsWith("jar:file")) return resources[i].getURL(); } } return resource.getURL(); }
@Override public URL getResource(String path) throws MalformedURLException { Resource resource=WebAppContext.this.getResource(path); if (resource==null || !resource.exists()) return null; // Should we go to the original war? if (resource.isDirectory() && resource instanceof ResourceCollection && !WebAppContext.this.isExtractWAR()) { Resource[] resources = ((ResourceCollection)resource).getResources(); for (int i=resources.length;i-->0;) { if (resources[i].getName().startsWith("jar:file")) return resources[i].getURL(); } } return resource.getURL(); }
@Override public URL getResource(String path) throws MalformedURLException { Resource resource=WebAppContext.this.getResource(path); if (resource==null || !resource.exists()) return null; // Should we go to the original war? if (resource.isDirectory() && resource instanceof ResourceCollection && !WebAppContext.this.isExtractWAR()) { Resource[] resources = ((ResourceCollection)resource).getResources(); for (int i=resources.length;i-->0;) { if (resources[i].getName().startsWith("jar:file")) return resources[i].getURL(); } } return resource.getURL(); }
@Override public URL getResource(String path) throws MalformedURLException { Resource resource=WebAppContext.this.getResource(path); if (resource==null || !resource.exists()) return null; // Should we go to the original war? if (resource.isDirectory() && resource instanceof ResourceCollection && !WebAppContext.this.isExtractWAR()) { Resource[] resources = ((ResourceCollection)resource).getResources(); for (int i=resources.length;i-->0;) { if (resources[i].getName().startsWith("jar:file")) return resources[i].getURL(); } } return resource.getURL(); }