public class Static extends Object
Cache behaviour can be tweeked with werval.controllers.static
config properties.
Always use streamed identity transfer encoding.
MimeType detection done using Application MimeTypes, fallback to application/octet-stream
.
Log 404 at DEBUG level.
Log 200 at TRACE level.
Keep in mind that not all deployment strategies will be compatible with the use of this controller.
Constructor and Description |
---|
Static() |
Modifier and Type | Method and Description |
---|---|
Outcome |
file(File file)
Serve a single file.
|
Outcome |
file(Path file)
Serve a single file.
|
Outcome |
file(String file)
Serve a single file.
|
Outcome |
tree(File root, String path)
Serve a filesystem directory as read-only resources.
|
Outcome |
tree(Path root, String path)
Serve a filesystem directory as read-only resources.
|
Outcome |
tree(String root, String path)
Serve a filesystem directory as read-only resources.
|
public Outcome tree(String root, String path)
If a directory is requested, filenames set in the werval.controllers.static.index
config property are used to find an index file. Default value is no index file support.
root
- Root of the file tree to serve
path
- Path of the requeted file, relative to root
public Outcome tree(Path root, String path)
If a directory is requested, filenames set in the werval.controllers.static.index
config property are used to find an index file. Default value is no index file support.
root
- Root of the file tree to serve
path
- Path of the requeted file, relative to root
public Outcome tree(File root, String path)
If a directory is requested, filenames set in the werval.controllers.static.index
config property are used to find an index file. Default value is no index file support.
root
- Root of the file tree to serve
path
- Path of the requeted file, relative to root
public Outcome file(String file)
file
- Path of the requested file
public Outcome file(Path file)
file
- Path of the requested file