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 ChannelHandlerContextctxprivate ChannelPromisehandshakePromiseprivate WebSocketServerProtocolConfigserverConfig
-
Constructor Summary
Constructors Constructor Description WebSocketServerProtocolHandshakeHandler(WebSocketServerProtocolConfig serverConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidapplyHandshakeTimeout()voidchannelRead(ChannelHandlerContext ctx, java.lang.Object msg)CallsChannelHandlerContext.fireChannelRead(Object)to forward to the nextChannelInboundHandlerin theChannelPipeline.private static java.lang.StringgetWebSocketLocation(ChannelPipeline cp, HttpRequest req, java.lang.String path)voidhandlerAdded(ChannelHandlerContext ctx)Do nothing by default, sub-classes may override this method.private booleanisNotWebSocketPath(FullHttpRequest req)private static voidsendHttpResponse(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:ChannelHandlerAdapterDo nothing by default, sub-classes may override this method.- Specified by:
handlerAddedin interfaceChannelHandler- Overrides:
handlerAddedin classChannelHandlerAdapter
-
channelRead
public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
Description copied from class:ChannelInboundHandlerAdapterCallsChannelHandlerContext.fireChannelRead(Object)to forward to the nextChannelInboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
channelReadin interfaceChannelInboundHandler- Overrides:
channelReadin 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()
-
-