| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private final Queue |
| Access | Constructor and Description |
|---|---|
| public | WebSocketServerExtensionHandler(WebSocketServerExtensionHandshaker...
The extension handshaker in priority order. A handshaker could be repeated many times
with fallback configuration. extensionHandshakers)Constructor |
| extensionHandshakers | back to summary |
|---|---|
| private final List<WebSocketServerExtensionHandshaker> extensionHandshakers | |
| validExtensions | back to summary |
|---|---|
| private final Queue<List<WebSocketServerExtension>> validExtensions | |
| WebSocketServerExtensionHandler | back to summary |
|---|---|
| public WebSocketServerExtensionHandler(WebSocketServerExtensionHandshaker... extensionHandshakers) Constructor
| |
| channelRead | back to summary |
|---|---|
| public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| handlePotentialUpgrade | back to summary |
|---|---|
| private void handlePotentialUpgrade(final ChannelHandlerContext ctx, ChannelPromise promise, HttpResponse httpResponse, final List<WebSocketServerExtension> validExtensionsList) | |
| onHttpRequestChannelRead | back to summary |
|---|---|
| protected void onHttpRequestChannelRead(ChannelHandlerContext ctx, HttpRequest request) throws Exception This is a method exposed to perform fail-fast checks of user-defined http types.
eg:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg != LastHttpContent.EMPTY_LAST_CONTENT) {
if (msg instanceof CustomHttpRequest) {
onHttpRequestChannelRead(ctx, (CustomHttpRequest) msg);
} else {
// if it's handling other HttpRequest types it MUST use onHttpRequestChannelRead again
// or have to delegate it to super.channelRead (that can perform redundant checks).
// If msg is not implementing HttpRequest, it can call ctx.fireChannelRead(msg) on it
// ...
super.channelRead(ctx, msg);
}
} else {
// given that msg isn't a HttpRequest type we can just skip calling super.channelRead
ctx.fireChannelRead(msg);
}
}
Important Note It already call
| |
| onHttpResponseWrite | back to summary |
|---|---|
| protected void onHttpResponseWrite(ChannelHandlerContext ctx, HttpResponse response, ChannelPromise promise) throws Exception This is a method exposed to perform fail-fast checks of user-defined http types.
eg:
public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
if (msg != Unpooled.EMPTY_BUFFER && !(msg instanceof ByteBuf)) {
if (msg instanceof CustomHttpResponse) {
onHttpResponseWrite(ctx, (CustomHttpResponse) msg, promise);
} else {
// if it's handling other HttpResponse types it MUST use onHttpResponseWrite again
// or have to delegate it to super.write (that can perform redundant checks).
// If msg is not implementing HttpResponse, it can call ctx.write(msg, promise) on it
// ...
super.write(ctx, msg, promise);
}
} else {
// given that msg isn't a HttpResponse type we can just skip calling super.write
ctx.write(msg, promise);
}
}
Important Note It already call
| |
| write | back to summary |
|---|---|
| public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception Overrides io. Implements io. Doc from io. Calls
| |