Package io.muserver.handlers
Class ResourceHandler
- java.lang.Object
-
- io.muserver.handlers.ResourceHandler
-
- All Implemented Interfaces:
MuHandler
public class ResourceHandler extends java.lang.Object implements MuHandler
A handler to serve static content. To create a handler, usingResourceHandlerBuilder.fileOrClasspath(String, String)
,ResourceHandlerBuilder.classpathHandler(String)
,ResourceHandlerBuilder.fileHandler(File)
or one of its variants.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
handle(MuRequest request, MuResponse response)
Called when an HTTP request is made (unless a previous handler stopped handler processing)java.lang.String
toString()
-
-
-
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 interfaceMuHandler
- 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); ortrue
to stop processing (normally done if this handler sent a response). - Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-