Class FileSystemResourceFactory

java.lang.Object
io.milton.http.fs.FileSystemResourceFactory
All Implemented Interfaces:
ResourceFactory

public final class FileSystemResourceFactory extends Object implements 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 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

      public FileSystemResourceFactory(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-fs
      securityManager -
    • FileSystemResourceFactory

      public FileSystemResourceFactory(File root, SecurityManager securityManager, String contextPath)
      Parameters:
      root - - the root folder of the filesystem to expose. called webdav-fs
      securityManager -
      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

      protected void init(String sRoot, SecurityManager securityManager)
    • getRoot

      public File getRoot()
    • setRoot

      public final void setRoot(File root)
    • getResource

      public Resource getResource(String host, String url)
      Specified by:
      getResource in interface ResourceFactory
    • resolveFile

      public FsResource resolveFile(String host, File file)
    • resolvePath

      public File resolvePath(File root, String url)
    • toResourcePath

      public String toResourcePath(File file)
    • getRealm

      public String getRealm(String host)
    • maxAgeSeconds

      public Long maxAgeSeconds(FsResource resource)
      Returns:
      - the caching time for files
    • setSecurityManager

      public void setSecurityManager(SecurityManager securityManager)
    • getSecurityManager

      public SecurityManager getSecurityManager()
    • setMaxAgeSeconds

      public void setMaxAgeSeconds(Long maxAgeSeconds)
    • getMaxAgeSeconds

      public Long getMaxAgeSeconds()
    • getLockManager

      public LockManager getLockManager()
    • setLockManager

      public void setLockManager(LockManager lockManager)
    • getPropertyManager

      public PropertyManager getPropertyManager()
    • setPropertyManager

      public void setPropertyManager(PropertyManager propertyManager)
    • setContextPath

      public void setContextPath(String contextPath)
    • getContextPath

      public String getContextPath()
    • isAllowDirectoryBrowsing

      public boolean isAllowDirectoryBrowsing()
      Whether to generate an index page.
      Returns:
    • setAllowDirectoryBrowsing

      public void setAllowDirectoryBrowsing(boolean allowDirectoryBrowsing)
    • getDefaultPage

      public 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(String defaultPage)
    • setDigestAllowed

      public void setDigestAllowed(boolean digestAllowed)
    • setSsoPrefix

      public void setSsoPrefix(String ssoPrefix)
    • getSsoPrefix

      public String getSsoPrefix()
    • getContentService

      public FileContentService getContentService()
    • setContentService

      public void setContentService(FileContentService contentService)
    • setWsManager

      public void setWsManager(WSManager wsManager)
    • getWsManager

      public Optional<WSManager> getWsManager()