public class AssetsDispatcher extends Object implements WebDispatcher
/assets
.
All assets are fetched from the classpath and should be located in the resources source root (below the assets directory).
This dispatcher tries to support caching as well as zero-copy delivery of static files if possible.
Constructor and Description |
---|
AssetsDispatcher() |
Modifier and Type | Method and Description |
---|---|
boolean |
dispatch(WebContext ctx)
Invoked in order to handle the given request.
|
void |
flushCompiledSCSS()
Flushes all cached and pre-computed scss / css files.
|
int |
getPriority()
Returns the priority to determine the position in the dispatcher list.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
dispatch, preparePreDispatch
public int getPriority()
WebDispatcher
Dispatchers are sorted ascending (lower is better). The default priority is
PriorityCollector.DEFAULT_PRIORITY
, the max. value is 998 as everything above
will be handled by the DefaultDispatcher
.
getPriority
in interface sirius.kernel.di.std.Priorized
getPriority
in interface WebDispatcher
public boolean dispatch(WebContext ctx) throws Exception
WebDispatcher
If the dispatcher doesn't feel responsible for handling the request, it simply returns false. Otherwise if the request is being handled, true must be returned
Note that no blocking operation must be performed in this method. For any complex interaction, a new thread
should be forked using Tasks.executor(String)
. Note that even
Response.outputStream(io.netty.handler.codec.http.HttpResponseStatus, String)
might
block sooner or later to limit heap memory usage - so fork a thread for any serious work besides checking
responsibilities for handling requests.
dispatch
in interface WebDispatcher
ctx
- the request to handleException
- in case of an error when parsing or dispatching the requestpublic void flushCompiledSCSS()
This can be used in environments where the scss files change due to included files. This isn't detected by the framework, as we only check the main file.
Copyright © 2018. All rights reserved.