public class WebSocketServerProtocolHandler extends WebSocketProtocolHandler
ChannelInboundHandler.userEventTriggered(ChannelHandlerContext, Object)
and check if the event was of type
WebSocketServerProtocolHandler.ServerHandshakeStateEvent.HANDSHAKE_COMPLETE
.Modifier and Type | Class and Description |
---|---|
static class |
WebSocketServerProtocolHandler.ServerHandshakeStateEvent
Events that are fired to notify about handshake status
|
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
private boolean |
allowExtensions |
private static AttributeKey<WebSocketServerHandshaker> |
HANDSHAKER_ATTR_KEY |
private int |
maxFramePayloadLength |
private java.lang.String |
subprotocols |
private java.lang.String |
websocketPath |
Constructor and Description |
---|
WebSocketServerProtocolHandler(java.lang.String websocketPath) |
WebSocketServerProtocolHandler(java.lang.String websocketPath,
java.lang.String subprotocols) |
WebSocketServerProtocolHandler(java.lang.String websocketPath,
java.lang.String subprotocols,
boolean allowExtensions) |
WebSocketServerProtocolHandler(java.lang.String websocketPath,
java.lang.String subprotocols,
boolean allowExtensions,
int maxFrameSize) |
Modifier and Type | Method and Description |
---|---|
protected void |
decode(ChannelHandlerContext ctx,
WebSocketFrame frame,
java.util.List<java.lang.Object> out)
Decode from one message to an other.
|
void |
exceptionCaught(ChannelHandlerContext ctx,
java.lang.Throwable cause)
Calls
ChannelHandlerContext.fireExceptionCaught(Throwable) to forward
to the next ChannelHandler in the ChannelPipeline . |
(package private) static ChannelHandler |
forbiddenHttpRequestResponder() |
(package private) static WebSocketServerHandshaker |
getHandshaker(Channel channel) |
void |
handlerAdded(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.
|
(package private) static void |
setHandshaker(Channel channel,
WebSocketServerHandshaker handshaker) |
acceptInboundMessage, channelRead
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerRemoved
private static final AttributeKey<WebSocketServerHandshaker> HANDSHAKER_ATTR_KEY
private final java.lang.String websocketPath
private final java.lang.String subprotocols
private final boolean allowExtensions
private final int maxFramePayloadLength
public WebSocketServerProtocolHandler(java.lang.String websocketPath)
public WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols)
public WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions)
public WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions, int maxFrameSize)
public void handlerAdded(ChannelHandlerContext ctx)
ChannelHandlerAdapter
handlerAdded
in interface ChannelHandler
handlerAdded
in class ChannelHandlerAdapter
protected void decode(ChannelHandlerContext ctx, WebSocketFrame frame, java.util.List<java.lang.Object> out) throws java.lang.Exception
MessageToMessageDecoder
decode
in class WebSocketProtocolHandler
ctx
- the ChannelHandlerContext
which this MessageToMessageDecoder
belongs toframe
- the message to decode to an other oneout
- the List
to which decoded messages should be addedjava.lang.Exception
- is thrown if an error accourpublic void exceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireExceptionCaught(Throwable)
to forward
to the next ChannelHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.exceptionCaught
in interface ChannelHandler
exceptionCaught
in interface ChannelInboundHandler
exceptionCaught
in class WebSocketProtocolHandler
java.lang.Exception
static WebSocketServerHandshaker getHandshaker(Channel channel)
static void setHandshaker(Channel channel, WebSocketServerHandshaker handshaker)
static ChannelHandler forbiddenHttpRequestResponder()