Class FolderContext


  • public class FolderContext
    extends Context
    This class publish some local folder in the web environment.
    Author:
    javaito
    • Constructor Detail

      • FolderContext

        public FolderContext​(java.lang.String name,
                             java.nio.file.Path baseFolder,
                             java.lang.String defaultFile)
      • FolderContext

        public FolderContext​(java.lang.String name,
                             java.nio.file.Path baseFolder)
    • Method Detail

      • onContext

        public final HttpResponse onContext​(HttpRequest request)
        This method is called when there comes a http package addressed to this context.
        Specified by:
        onContext in class Context
        Parameters:
        request - All the request information.
        Returns:
        Return an object with all the response information.
      • onNonExistentFile

        public boolean onNonExistentFile​(HttpRequest request,
                                         java.io.File file)
        This method could be implemented in order to manage the non-existent file situation. By default this implementation throws an IllegalArgument exception if the file not exists.
        Parameters:
        request - Http request instance.
        file - non-existent file pointer.
        Returns:
        Return true if the read file operation must by retried and false in the otherwise.