Package io.milton.http.fs
Class FileSystemResourceFactory
java.lang.Object
io.milton.http.fs.FileSystemResourceFactory
- All Implemented Interfaces:
ResourceFactory
A resource factory which provides access to files in a file system.
Using this with milton is equivalent to using the dav servlet in tomcat
-
Constructor Summary
ConstructorsConstructorDescriptionCreates and (optionally) initialises the factory.FileSystemResourceFactory(File root, SecurityManager securityManager) FileSystemResourceFactory(File root, SecurityManager securityManager, String contextPath) -
Method Summary
Modifier and TypeMethodDescriptionif provided GET requests to a folder will redirect to a page of this name within the foldergetResource(String host, String url) getRoot()protected voidinit(String sRoot, SecurityManager securityManager) booleanWhether to generate an index page.maxAgeSeconds(FsResource resource) resolveFile(String host, File file) resolvePath(File root, String url) voidsetAllowDirectoryBrowsing(boolean allowDirectoryBrowsing) voidsetContentService(FileContentService contentService) voidsetContextPath(String contextPath) voidsetDefaultPage(String defaultPage) voidsetDigestAllowed(boolean digestAllowed) voidsetLockManager(LockManager lockManager) voidsetMaxAgeSeconds(Long maxAgeSeconds) voidsetPropertyManager(PropertyManager propertyManager) final voidvoidsetSecurityManager(SecurityManager securityManager) voidsetSsoPrefix(String ssoPrefix) voidsetWsManager(WSManager wsManager) toResourcePath(File file)
-
Constructor Details
-
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
- 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
- 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
-
-
Method Details
-
init
-
getRoot
-
setRoot
-
getResource
- Specified by:
getResourcein interfaceResourceFactory
-
resolveFile
-
resolvePath
-
toResourcePath
-
getRealm
-
maxAgeSeconds
- Returns:
- - the caching time for files
-
setSecurityManager
-
getSecurityManager
-
setMaxAgeSeconds
-
getMaxAgeSeconds
-
getLockManager
-
setLockManager
-
getPropertyManager
-
setPropertyManager
-
setContextPath
-
getContextPath
-
isAllowDirectoryBrowsing
public boolean isAllowDirectoryBrowsing()Whether to generate an index page.- Returns:
-
setAllowDirectoryBrowsing
public void setAllowDirectoryBrowsing(boolean allowDirectoryBrowsing) -
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
-
setDigestAllowed
public void setDigestAllowed(boolean digestAllowed) -
setSsoPrefix
-
getSsoPrefix
-
getContentService
-
setContentService
-
setWsManager
-
getWsManager
-