| Modifier and Type | Field and Description |
|---|---|
| private final Consumer | |
| private final Configuration. | |
| private final WebSocketMappings |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | WebSocketUpgradeHandler(WebSocketComponents components, Consumer<WebSocketUpgradeHandler> configurator)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| protected void | doStart()
Overrides org. Starts the managed lifecycle beans in the order they were added. |
| public Configuration | |
| 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. |
| _configurator | back to summary |
|---|---|
| private final Consumer<WebSocketUpgradeHandler> _configurator | |
| _customizer | back to summary |
|---|---|
| private final Configuration. | |
| _mappings | back to summary |
|---|---|
| private final WebSocketMappings _mappings | |
| WebSocketUpgradeHandler | back to summary |
|---|---|
| public WebSocketUpgradeHandler() | |
| WebSocketUpgradeHandler | back to summary |
|---|---|
| public WebSocketUpgradeHandler(WebSocketComponents components) | |
| WebSocketUpgradeHandler | back to summary |
|---|---|
| public WebSocketUpgradeHandler(Consumer<WebSocketUpgradeHandler> configurator) | |
| WebSocketUpgradeHandler | back to summary |
|---|---|
| public WebSocketUpgradeHandler(WebSocketComponents components, Consumer<WebSocketUpgradeHandler> configurator) | |
| addMapping | back to summary |
|---|---|
| public void addMapping(String pathSpec, WebSocketNegotiator negotiator) | |
| addMapping | back to summary |
|---|---|
| public void addMapping(PathSpec pathSpec, WebSocketNegotiator negotiator) | |
| doStart | back to summary |
|---|---|
| protected void doStart() throws Exception Overrides org. Doc from org. Starts the managed lifecycle beans in the order they were added.
| |
| getConfiguration | back to summary |
|---|---|
| public Configuration getConfiguration() | |
| 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;
}
| |