public class AssetHandler extends Object implements Route.Handler
Asset
contract.Constructor and Description |
---|
AssetHandler(AssetSource... sources)
Creates a new asset handler.
|
Modifier and Type | Method and Description |
---|---|
Object |
apply(Context ctx)
Execute application code.
|
AssetHandler |
setETag(boolean etag)
Turn on/off e-tag support.
|
AssetHandler |
setLastModified(boolean lastModified)
Turn on/off handling of
If-Modified-Since header. |
AssetHandler |
setMaxAge(Duration maxAge)
Set cache-control header with the given max-age value.
|
AssetHandler |
setMaxAge(long maxAge)
Set cache-control header with the given max-age value.
|
Route.Handler |
setRoute(Route route)
Allows a handler to listen for route metadata.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
then
public AssetHandler(AssetSource... sources)
sources
- Asset sources.@Nonnull public Object apply(@Nonnull Context ctx) throws Exception
Route.Handler
apply
in interface Route.Handler
ctx
- Web context.Exception
- If something goes wrong.public AssetHandler setETag(boolean etag)
etag
- True for turning on.public AssetHandler setLastModified(boolean lastModified)
If-Modified-Since
header.lastModified
- True for turning on. Default is: true.public AssetHandler setMaxAge(long maxAge)
maxAge
- Max-age value in seconds.public AssetHandler setMaxAge(Duration maxAge)
maxAge
- Max-age value in seconds.public Route.Handler setRoute(Route route)
Route.Handler
setRoute
in interface Route.Handler
route
- Route metadata.Copyright © 2019. All rights reserved.