ContextHandlers.
The contexts do not need to be directly contained, only children of the contained handlers.
Multiple contexts may have the same context path and they are called in order until one
handles the request.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final SerializedExecutor | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ContextHandlerCollection(boolean
If true, then contexts may be added dynamically once started,
so the InvocationType is assumed to be BLOCKING, otherwise
the InvocationType is fixed once started and handlers cannot be
subsequently added. dynamic, ContextHandler... The contexts to add. contexts)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | deployHandler(Handler
the handler to deploy handler, Callback Called after handler has been added callback)Thread safe deploy of a Handler. |
| public Set | |
| public boolean | handle(Request
the HTTP request to handle request, Response the HTTP response to handle response, Callback the callback to complete when the handling is complete callback)Overrides org. Implements org. Invoked to handle the passed HTTP request and response. |
| public void | |
| protected List | |
| public void | undeployHandler(Handler
The handler to undeploy handler, Callback Called after handler has been removed callback)Thread safe undeploy of a Handler. |
| _serializedExecutor | back to summary |
|---|---|
| private final SerializedExecutor _serializedExecutor | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| ContextHandlerCollection | back to summary |
|---|---|
| public ContextHandlerCollection(ContextHandler... contexts) | |
| ContextHandlerCollection | back to summary |
|---|---|
public ContextHandlerCollection(boolean dynamic, ContextHandler... contexts)
| |
| deployHandler | back to summary |
|---|---|
| public void deployHandler(Handler handler, Callback callback) Thread safe deploy of a Handler.
This method is the equivalent of | |
| getContextPaths | back to summary |
|---|---|
public Set
| |
| handle | back to summary |
|---|---|
| public boolean handle(Request request, Response response, Callback callback) throws Exception Overrides org. Implements org. Doc from org. Invoked to handle the passed HTTP request and response. The request is accepted by returning true, then handling must be concluded by completing the passed callback. The handling may be asynchronous, i.e. this method may return true and complete the given callback later, possibly from a different thread. If this method returns false, then the callback must not be invoked and any mutation on the response reversed. Exceptions thrown by this method may be subsequently handled by an error The simplest implementation is:
public boolean handle(Request request, Response response, Callback callback)
{
callback.succeeded();
return true;
}
A HelloWorld implementation is:
public boolean handle(Request request, Response response, Callback callback)
{
response.write(true, ByteBuffer.wrap("Hello World\n".getBytes(StandardCharsets.UTF_8)), callback);
return true;
}
| |
| mapContexts | back to summary |
|---|---|
| public void mapContexts() Remap the contexts. Normally this is not required as context
mapping is maintained as a side effect of
| |
| newHandlers | back to summary |
|---|---|
| protected List Overrides org.
| |
| undeployHandler | back to summary |
|---|---|
| public void undeployHandler(Handler handler, Callback callback) Thread safe undeploy of a Handler.
This method is the equivalent of | |
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private final Handler |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv Set | |
| pack-priv Handler | |
| pack-priv boolean | |
| public String |
| _contexts | back to summary |
|---|---|
| private final List<ContextHandler> _contexts | |
| _handler | back to summary |
|---|---|
| private final Handler _handler | |
| Branch | back to summary |
|---|---|
| pack-priv Branch(Handler handler) | |
| getContextPaths | back to summary |
|---|---|
| pack-priv Set | |
| getHandler | back to summary |
|---|---|
| pack-priv Handler getHandler() | |
| hasVirtualHost | back to summary |
|---|---|
| pack-priv boolean hasVirtualHost() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Index |
| Access | Constructor and Description |
|---|---|
| private |
| _pathBranches | back to summary |
|---|---|
| private final Index<Map. | |
| Mapping | back to summary |
|---|---|
| private Mapping(List<Handler> handlers, Map<String, ContextHandlerCollection. | |