public class FileSystemResourceOrigin extends AbstractResourceOrigin<FileSystemResource>
ResourceOrigin
which loads resources on the file system.ResourceOrigin.ResourceNotFoundException
Modifier and Type | Field and Description |
---|---|
static String |
RESOURCES_DIR_PROPERTY |
Modifier and Type | Method and Description |
---|---|
protected ExclusionsFilter |
buildExclusionsFilter()
Builds exclusion filter, if present uses magnolia.resources.filesystem.observation.excludedDirectories property
for defining excluded root directories.
|
protected InputStream |
doOpenStream(FileSystemResource resource) |
protected boolean |
existsAndAllowed(Path filePath) |
FileSystemResource |
getByPath(String path)
Retrieves a
Resource object based on the given path. |
protected Charset |
getCharsetFor(FileSystemResource resource)
|
protected long |
getLastModified(FileSystemResource resource) |
protected String |
getName(FileSystemResource resource) |
protected FileSystemResource |
getParent(FileSystemResource resource) |
protected String |
getPath(FileSystemResource resource) |
protected Path |
getPath(String path) |
FileSystemResource |
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(FileSystemResource resource) |
protected boolean |
isFile(FileSystemResource resource) |
protected List<FileSystemResource> |
listChildren(FileSystemResource resource) |
protected FileSystemResource |
newResource(Path path)
Create a
Resource out of a relative path. |
String |
parseResourcePath(Path realPath)
Relativize a real path against this
origin's root path and normalize it. |
protected Path |
validateRootPath(String path) |
dispatchResourceChange, getName, isEditable, openReader, openStream, registerResourceChangeHandler, traverseWith, watchForChanges
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
find, find
public static final String RESOURCES_DIR_PROPERTY
protected ExclusionsFilter buildExclusionsFilter()
default
list of excluded directories.public FileSystemResource getRoot()
ResourceOrigin
Resource
for this origin's declared root.public FileSystemResource 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)
protected void initializeResourceChangeMonitoring()
AbstractResourceOrigin
initializeResourceChangeMonitoring
in class AbstractResourceOrigin<FileSystemResource>
protected boolean isFile(FileSystemResource resource)
isFile
in class AbstractResourceOrigin<FileSystemResource>
Resource.isFile()
protected boolean isDirectory(FileSystemResource resource)
isDirectory
in class AbstractResourceOrigin<FileSystemResource>
Resource.isDirectory()
protected String getPath(FileSystemResource resource)
getPath
in class AbstractResourceOrigin<FileSystemResource>
Resource.getPath()
public String parseResourcePath(Path realPath)
origin's
root path and normalize it.realPath
- path in file systemprotected String getName(FileSystemResource resource)
getName
in class AbstractResourceOrigin<FileSystemResource>
Resource.getName()
protected long getLastModified(FileSystemResource resource)
getLastModified
in class AbstractResourceOrigin<FileSystemResource>
Resource.getLastModified()
protected List<FileSystemResource> listChildren(FileSystemResource resource)
listChildren
in class AbstractResourceOrigin<FileSystemResource>
Resource.listChildren()
protected FileSystemResource getParent(FileSystemResource resource)
getParent
in class AbstractResourceOrigin<FileSystemResource>
Resource.getParent()
protected InputStream doOpenStream(FileSystemResource resource) throws IOException
doOpenStream
in class AbstractResourceOrigin<FileSystemResource>
IOException
protected Charset getCharsetFor(FileSystemResource resource)
AbstractResourceOrigin
getCharsetFor
in class AbstractResourceOrigin<FileSystemResource>
protected boolean existsAndAllowed(Path filePath)
protected FileSystemResource newResource(Path path)
Resource
out of a relative path.path
- expected to be a relative path under the rootPathCopyright © 2003–2020 Magnolia International Ltd.. All rights reserved.