Class ResourceHandler

    • Method Detail

      • handle

        public boolean handle​(MuRequest request,
                              MuResponse response)
                       throws java.io.IOException
        Description copied from interface: MuHandler
        Called when an HTTP request is made (unless a previous handler stopped handler processing)
        Specified by:
        handle in interface MuHandler
        Parameters:
        request - The HTTP request.
        response - The HTTP response.
        Returns:
        Return false to continue processing the next handler (for example if writing a filter or inspector); or true to stop processing (normally done if this handler sent a response).
        Throws:
        java.io.IOException
      • getPathToServeFrom

        @Deprecated
        public java.lang.String getPathToServeFrom()
        Deprecated.
        This is a temporary accessor which will be demised. Do not use this.
        Returns:
        This is a temporary accessor which will be demised. Do not use this.
      • fileOrClasspath

        @Deprecated
        public static ResourceHandler.Builder fileOrClasspath​(java.lang.String fileRootIfExists,
                                                              java.lang.String classpathRoot)
        Creates a resource handler that serves from the file system if the directory exists; otherwise from the class path.

        A common use case is for when you want to serve from the file path at development time (so you can update files without restarting) but at deploy time resources are packaged in an uber jar.

        Parameters:
        fileRootIfExists - A path to a directory holding static content, which may not exist, e.g. src/main/resources/web
        classpathRoot - A classpath path to a directory holding static content, e.g. /web
        Returns:
        Returns a file-based resource handler builder or a classpath-based one.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object