public class ServiceDispatcher extends Object implements WebDispatcher
Processes calls to /service/[format]/service-name, by dispatching them to the appropriate
StructuredService
and selecting the matching StructuredOutput
based on the given
format (either json or xml).
Constructor and Description |
---|
ServiceDispatcher() |
Modifier and Type | Method and Description |
---|---|
boolean |
dispatch(WebContext ctx)
Invoked in order to handle the given request.
|
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 requestCopyright © 2018. All rights reserved.