com.ettrema.http.fs
Class FileSystemResourceFactory
java.lang.Object
com.ettrema.http.fs.FileSystemResourceFactory
- All Implemented Interfaces:
- ResourceFactory
public class FileSystemResourceFactory
- extends java.lang.Object
- implements ResourceFactory
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileSystemResourceFactory
public FileSystemResourceFactory()
- Creates and (optionally) initialises the factory. This looks for a
properties file FileSystemResourceFactory.properties in the classpath
If one is found it uses the root and realm properties to initialise
If not found the factory is initialised with the defaults
root: user.home system property
realm: milton-fs-test
These initialised values are not final, and may be changed through the
setters or init method
To be honest its pretty naf configuring like this, but i don't want to
force people to use spring or any other particular configuration tool
FileSystemResourceFactory
public FileSystemResourceFactory(java.io.File root,
SecurityManager securityManager)
- Parameters:
root - - the root folder of the filesystem to expose. This must include
the context path. Eg, if you've deployed to webdav-fs, root must contain a folder
called webdav-fssecurityManager -
FileSystemResourceFactory
public FileSystemResourceFactory(java.io.File root,
SecurityManager securityManager,
java.lang.String contextPath)
- Parameters:
root - - the root folder of the filesystem to expose.
called webdav-fssecurityManager - contextPath - - this is the leading part of URL's to ignore. For example
if you're application is deployed to http://localhost:8080/webdav-fs, the
context path should be webdav-fs
init
protected void init(java.lang.String sRoot,
SecurityManager securityManager)
getRoot
public java.io.File getRoot()
setRoot
public void setRoot(java.io.File root)
getResource
public Resource getResource(java.lang.String host,
java.lang.String url)
- Specified by:
getResource in interface ResourceFactory
getSupportedLevels
public java.lang.String getSupportedLevels()
resolveFile
public FsResource resolveFile(java.lang.String host,
java.io.File file)
resolvePath
public java.io.File resolvePath(java.io.File root,
java.lang.String url)
getRealm
public java.lang.String getRealm(java.lang.String host)
maxAgeSeconds
public java.lang.Long maxAgeSeconds(FsResource resource)
- Returns:
- - the caching time for files
setSecurityManager
public void setSecurityManager(SecurityManager securityManager)
getSecurityManager
public SecurityManager getSecurityManager()
setMaxAgeSeconds
public void setMaxAgeSeconds(java.lang.Long maxAgeSeconds)
getMaxAgeSeconds
public java.lang.Long getMaxAgeSeconds()
getLockManager
public LockManager getLockManager()
setLockManager
public void setLockManager(LockManager lockManager)
setContextPath
public void setContextPath(java.lang.String contextPath)
getContextPath
public java.lang.String getContextPath()
isAllowDirectoryBrowsing
public boolean isAllowDirectoryBrowsing()
- Whether to generate an index page.
- Returns:
setAllowDirectoryBrowsing
public void setAllowDirectoryBrowsing(boolean allowDirectoryBrowsing)
getDefaultPage
public java.lang.String getDefaultPage()
- if provided GET requests to a folder will redirect to a page of this name
within the folder
- Returns:
- - E.g. index.html
setDefaultPage
public void setDefaultPage(java.lang.String defaultPage)
Copyright © 2011. All Rights Reserved.