Class WSFileProviderEngine

  • All Implemented Interfaces:
    IWSFileProviderServer

    public class WSFileProviderEngine
    extends java.lang.Object
    implements IWSFileProviderServer
    Engine to handle file providing for external web server files, typically images and other client resources that are fetched from the web server.

    The file contexts are:

    • Server session,
    • Per application (and version),
    • Per user (all sessions),
    • Per application session (on user basis),
    • Per client session.

    The server places these files in subdirectories in the file provider directory configured for the server (default "wsfiles" in ServerSettings.DEFAULT_FILE_PROVIDER_ROOT).

    Author:
    Christopher Mindus
    See Also:
    WSFile, WSFileType
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Disposes of the engine and all the providers.
      WSFileProvider getCreateFileProvider​(WSFileType type, java.lang.String descr, java.lang.String subject, boolean doPersistFileNames)
      Gets or creates a new engine type file provider.
      java.io.File getFileResourceFromExternalURL​(java.lang.String target)
      Gets the file resource for an external URL that starts with "/".
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WSFileProviderEngine

        public WSFileProviderEngine​(ServerSettings serverSettings)
                             throws java.io.IOException
        Constructs a new engine.
        Parameters:
        serverSettings - The server settings.
        Throws:
        java.io.IOException - If the root directory for the files cannot be created.
      • WSFileProviderEngine

        public WSFileProviderEngine​(java.io.File serverRootDir,
                                    ServerSettings serverSettings)
                             throws java.io.IOException
        Constructs a new engine for the Designer First-Time-Start dialog to assign a profile image.
        Parameters:
        serverRootDir - The server root directory.
        serverSettings - The server settings.
        Throws:
        java.io.IOException - If the root directory for the files cannot be created.
    • Method Detail

      • getCreateFileProvider

        public WSFileProvider getCreateFileProvider​(WSFileType type,
                                                    java.lang.String descr,
                                                    java.lang.String subject,
                                                    boolean doPersistFileNames)
                                             throws java.io.IOException
        Gets or creates a new engine type file provider. Depending on the engine type, just one may be created for a particular subject.
        Parameters:
        type - The engine type.
        descr - The description used for logging (ignored for single WSFileType's)
        subject - The subject when multiple file providers is supported, null (or ignored) for single types.
        doPersistFileNames - Flag to use the real file name for client caching purposes. Otherwise a unique file name is always generated.
        Returns:
        The file provider.
        Throws:
        java.io.IOException - If the sub-directory for the file provider type cannot be created.
        java.lang.NullPointerException - If the subject is required but is null.
        java.lang.IllegalStateException - If the engine is disposed of.
      • getFileResourceFromExternalURL

        public java.io.File getFileResourceFromExternalURL​(java.lang.String target)
        Gets the file resource for an external URL that starts with "/".
        Specified by:
        getFileResourceFromExternalURL in interface IWSFileProviderServer
        Parameters:
        target - The target request.
        Returns:
        The file target, or null if it is not found.
      • dispose

        public void dispose()
        Disposes of the engine and all the providers.