public class ControllerDispatcher extends Object implements WebDispatcher
Controller.| Modifier and Type | Field and Description |
|---|---|
protected static sirius.kernel.health.Log |
LOG |
| Constructor and Description |
|---|
ControllerDispatcher() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
dispatch(WebContext ctx)
Invoked in order to handle the given request.
|
int |
getPriority()
The priority of this controller is
PriorityCollector.DEFAULT_PRIORITY + 10 as it is quite complex
to check each request against each route. |
List<Route> |
getRoutes()
Returns a list of all
routes known to the dispatcher. |
sirius.kernel.commons.Callback<WebContext> |
preparePreDispatch(WebContext ctx)
Invoked as soon as the complete request but not its contents are available.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdispatchpublic int getPriority()
PriorityCollector.DEFAULT_PRIORITY + 10 as it is quite complex
to check each request against each route.getPriority in interface sirius.kernel.di.std.PriorizedgetPriority in interface WebDispatcherpublic sirius.kernel.commons.Callback<WebContext> preparePreDispatch(WebContext ctx)
WebDispatcher
In contrast to WebDispatcher.dispatch(WebContext) this method is invoked before the complete data is accumulated.
This permits the handler to install an ContentHandler using WebContext.setContentHandler(ContentHandler)
in order to directly process the uploaded data. A request for which true was replied will not
be dispatched again once it is complete.
Note thatthis method will be invoked within the event loop of the web-server, therefore absolutely no blocking operations must be performed. However, the returned Callback is executed in its own thread and free of any constraints.
preparePreDispatch in interface WebDispatcherctx - the request to handlepreparePreDispatch(WebContext)public boolean dispatch(WebContext ctx) throws Exception
WebDispatcherIf 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 WebDispatcherctx - the request to handleException - in case of an error when parsing or dispatching the requestCopyright © 2018. All rights reserved.