public class ClasspathResourceOrigin extends AbstractResourceOrigin<ClasspathResource>
ResourceOrigin
which serves resources collected from the web application classpath.
Classpath file/folder hierarchy is provided by the classpath service
which also acts as a delegate
for most of this origin's calls.ClasspathService
,
ClasspathResource
ResourceOrigin.ResourceNotFoundException
Constructor and Description |
---|
ClasspathResourceOrigin(String name,
ClasspathService classpathService) |
Modifier and Type | Method and Description |
---|---|
protected InputStream |
doOpenStream(ClasspathResource resource) |
ClasspathResource |
getByPath(String path)
Retrieves a
Resource object based on the given path. |
protected Charset |
getCharsetFor(ClasspathResource resource)
|
protected long |
getLastModified(ClasspathResource resource) |
protected String |
getName(ClasspathResource resource) |
protected ClasspathResource |
getParent(ClasspathResource resource) |
protected String |
getPath(ClasspathResource resource) |
ClasspathResource |
getRoot()
Returns the
Resource for this origin's declared root. |
boolean |
hasPath(String path) |
protected void |
initializeResourceChangeMonitoring()
Start monitoring underlying resource changes.
|
protected boolean |
isDirectory(ClasspathResource resource) |
protected boolean |
isFile(ClasspathResource resource) |
protected List<ClasspathResource> |
listChildren(ClasspathResource resource) |
dispatchResourceChange, getName, isEditable, openReader, openStream, registerResourceChangeHandler, traverseWith, watchForChanges
public ClasspathResourceOrigin(String name, ClasspathService classpathService)
protected void initializeResourceChangeMonitoring()
AbstractResourceOrigin
initializeResourceChangeMonitoring
in class AbstractResourceOrigin<ClasspathResource>
protected boolean isFile(ClasspathResource resource)
isFile
in class AbstractResourceOrigin<ClasspathResource>
Resource.isFile()
protected boolean isDirectory(ClasspathResource resource)
isDirectory
in class AbstractResourceOrigin<ClasspathResource>
Resource.isDirectory()
protected String getPath(ClasspathResource resource)
getPath
in class AbstractResourceOrigin<ClasspathResource>
Resource.getPath()
protected String getName(ClasspathResource resource)
getName
in class AbstractResourceOrigin<ClasspathResource>
Resource.getName()
protected long getLastModified(ClasspathResource resource)
getLastModified
in class AbstractResourceOrigin<ClasspathResource>
Resource.getLastModified()
protected List<ClasspathResource> listChildren(ClasspathResource resource)
listChildren
in class AbstractResourceOrigin<ClasspathResource>
Resource.listChildren()
protected ClasspathResource getParent(ClasspathResource resource)
getParent
in class AbstractResourceOrigin<ClasspathResource>
Resource.getParent()
protected InputStream doOpenStream(ClasspathResource resource) throws IOException
doOpenStream
in class AbstractResourceOrigin<ClasspathResource>
IOException
protected Charset getCharsetFor(ClasspathResource resource)
AbstractResourceOrigin
getCharsetFor
in class AbstractResourceOrigin<ClasspathResource>
public ClasspathResource getRoot()
ResourceOrigin
Resource
for this origin's declared root.public ClasspathResource getByPath(String path)
ResourceOrigin
Resource
object based on the given path. The given path may or may not start with a
leading /, but will always be considered relative to whatever root path this origin uses; for the user of this
class, such paths should thus be considered absolute, depending on the implementation, they may be relative
to some other path. Directory traversal navigation should be prohibited by implementations for security reasons.public boolean hasPath(String path)
Copyright © 2003–2016 Magnolia International Ltd.. All rights reserved.