PathMappings.
| Modifier and Type | Field and Description |
|---|---|
| private static final Logger | |
| private final PathMappings |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | dump(Appendable
The appendable to dump to out, String The indent to apply after any new lines. indent)Overrides org. Implements org. |
| public List | |
| 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)Implements org. Invoked to handle the passed HTTP request and response. |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| mappings | back to summary |
|---|---|
| private final PathMappings<Handler> mappings | |
| PathMappingsHandler | back to summary |
|---|---|
| public PathMappingsHandler() | |
| PathMappingsHandler | back to summary |
|---|---|
| public PathMappingsHandler(boolean dynamic) | |
| addMapping | back to summary |
|---|---|
| public void addMapping(PathSpec pathSpec, Handler handler) | |
| dump | back to summary |
|---|---|
| public void dump(Appendable out, String indent) throws IOException Overrides org. Implements org. Doc from org. Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
| |
| getHandlers | back to summary |
|---|---|
| public List Implements org.
| |
| handle | back to summary |
|---|---|
| public boolean handle(Request request, Response response, Callback callback) throws Exception 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;
}
| |