Class WebSocketServerProtocolHandshakeHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandshakeHandler
-
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
class WebSocketServerProtocolHandshakeHandler extends ChannelInboundHandlerAdapter
Handles the HTTP handshake (the HTTP Upgrade request) forWebSocketServerProtocolHandler
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Field Summary
Fields Modifier and Type Field Description private ChannelHandlerContext
ctx
private ChannelPromise
handshakePromise
private WebSocketServerProtocolConfig
serverConfig
-
Constructor Summary
Constructors Constructor Description WebSocketServerProtocolHandshakeHandler(WebSocketServerProtocolConfig serverConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
applyHandshakeTimeout()
void
channelRead(ChannelHandlerContext ctx, java.lang.Object msg)
CallsChannelHandlerContext.fireChannelRead(Object)
to forward to the nextChannelInboundHandler
in theChannelPipeline
.private static java.lang.String
getWebSocketLocation(ChannelPipeline cp, HttpRequest req, java.lang.String path)
void
handlerAdded(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.private boolean
isNotWebSocketPath(FullHttpRequest req)
private static void
sendHttpResponse(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res)
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelHandler
handlerRemoved
-
-
-
-
Field Detail
-
serverConfig
private final WebSocketServerProtocolConfig serverConfig
-
ctx
private ChannelHandlerContext ctx
-
handshakePromise
private ChannelPromise handshakePromise
-
-
Constructor Detail
-
WebSocketServerProtocolHandshakeHandler
WebSocketServerProtocolHandshakeHandler(WebSocketServerProtocolConfig serverConfig)
-
-
Method Detail
-
handlerAdded
public void handlerAdded(ChannelHandlerContext ctx)
Description copied from class:ChannelHandlerAdapter
Do nothing by default, sub-classes may override this method.- Specified by:
handlerAdded
in interfaceChannelHandler
- Overrides:
handlerAdded
in classChannelHandlerAdapter
-
channelRead
public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelRead(Object)
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelRead
in interfaceChannelInboundHandler
- Overrides:
channelRead
in classChannelInboundHandlerAdapter
- Throws:
java.lang.Exception
-
isNotWebSocketPath
private boolean isNotWebSocketPath(FullHttpRequest req)
-
sendHttpResponse
private static void sendHttpResponse(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res)
-
getWebSocketLocation
private static java.lang.String getWebSocketLocation(ChannelPipeline cp, HttpRequest req, java.lang.String path)
-
applyHandshakeTimeout
private void applyHandshakeTimeout()
-
-