public class ResourceHandler extends Object implements MuHandler
ResourceHandlerBuilder.fileOrClasspath(String, String)
,
ResourceHandlerBuilder.classpathHandler(String)
, ResourceHandlerBuilder.fileHandler(File)
or one of its variants.Modifier and Type | Class and Description |
---|---|
static class |
ResourceHandler.Builder
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static ResourceHandler.Builder |
classpathHandler(String classpathRoot)
Deprecated.
|
static ResourceHandler.Builder |
fileHandler(File baseDirectory)
Deprecated.
|
static ResourceHandler.Builder |
fileHandler(Path path)
Deprecated.
|
static ResourceHandler.Builder |
fileHandler(String directoryPath)
Deprecated.
|
static ResourceHandler.Builder |
fileOrClasspath(String fileRootIfExists,
String classpathRoot)
Deprecated.
|
String |
getPathToServeFrom()
Deprecated.
This is a temporary accessor which will be demised. Do not use this.
|
boolean |
handle(MuRequest request,
MuResponse response)
Called when an HTTP request is made (unless a previous handler stopped handler processing)
|
public boolean handle(MuRequest request, MuResponse response) throws IOException
MuHandler
handle
in interface MuHandler
request
- The HTTP request.response
- The HTTP response.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).IOException
@Deprecated public String getPathToServeFrom()
@Deprecated public static ResourceHandler.Builder fileHandler(String directoryPath)
ResourceHandlerBuilder.fileHandler(String)
directoryPath
- The directory.@Deprecated public static ResourceHandler.Builder fileHandler(File baseDirectory)
ResourceHandlerBuilder.fileHandler(File)
baseDirectory
- The directory.@Deprecated public static ResourceHandler.Builder fileHandler(Path path)
ResourceHandlerBuilder.fileHandler(Path)
path
- The directory.@Deprecated public static ResourceHandler.Builder classpathHandler(String classpathRoot)
ResourceHandlerBuilder.classpathHandler(String)
classpathRoot
- A classpath directory, such as /web
@Deprecated public static ResourceHandler.Builder fileOrClasspath(String fileRootIfExists, String classpathRoot)
ResourceHandlerBuilder.fileOrClasspath(String, String)
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.
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
Copyright © 2017–2020. All rights reserved.