Class WebSocketServerProtocolHandler
- java.lang.Object
-
- org.jboss.netty.channel.SimpleChannelUpstreamHandler
-
- org.jboss.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler
-
- All Implemented Interfaces:
ChannelHandler,ChannelUpstreamHandler,LifeCycleAwareChannelHandler
public class WebSocketServerProtocolHandler extends SimpleChannelUpstreamHandler implements LifeCycleAwareChannelHandler
Handles WebSocket control frames (Close, Ping, Pong) and data frames (Text and Binary) are passed to the next handler in the pipeline.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Field Summary
Fields Modifier and Type Field Description private booleanallowExtensionsprivate java.lang.Stringsubprotocolsprivate java.lang.StringwebsocketPath
-
Constructor Summary
Constructors Constructor 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)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterAdd(ChannelHandlerContext ctx)voidafterRemove(ChannelHandlerContext ctx)voidbeforeAdd(ChannelHandlerContext ctx)voidbeforeRemove(ChannelHandlerContext ctx)voidexceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)Invoked when an exception was raised by an I/O thread or aChannelHandler.(package private) static ChannelHandlerforbiddenHttpRequestResponder()(package private) static WebSocketServerHandshakergetHandshaker(ChannelHandlerContext ctx)voidmessageReceived(ChannelHandlerContext ctx, MessageEvent e)Invoked when a message object (e.g:ChannelBuffer) was received from a remote peer.(package private) static voidsetHandshaker(ChannelHandlerContext ctx, WebSocketServerHandshaker handshaker)-
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete
-
-
-
-
Constructor Detail
-
WebSocketServerProtocolHandler
public WebSocketServerProtocolHandler(java.lang.String websocketPath)
-
WebSocketServerProtocolHandler
public WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols)
-
WebSocketServerProtocolHandler
public WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions)
-
-
Method Detail
-
afterAdd
public void afterAdd(ChannelHandlerContext ctx) throws java.lang.Exception
- Specified by:
afterAddin interfaceLifeCycleAwareChannelHandler- Throws:
java.lang.Exception
-
messageReceived
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws java.lang.Exception
Description copied from class:SimpleChannelUpstreamHandlerInvoked when a message object (e.g:ChannelBuffer) was received from a remote peer.- Overrides:
messageReceivedin classSimpleChannelUpstreamHandler- Throws:
java.lang.Exception
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws java.lang.Exception
Description copied from class:SimpleChannelUpstreamHandlerInvoked when an exception was raised by an I/O thread or aChannelHandler.- Overrides:
exceptionCaughtin classSimpleChannelUpstreamHandler- Throws:
java.lang.Exception
-
getHandshaker
static WebSocketServerHandshaker getHandshaker(ChannelHandlerContext ctx)
-
setHandshaker
static void setHandshaker(ChannelHandlerContext ctx, WebSocketServerHandshaker handshaker)
-
forbiddenHttpRequestResponder
static ChannelHandler forbiddenHttpRequestResponder()
-
beforeAdd
public void beforeAdd(ChannelHandlerContext ctx) throws java.lang.Exception
- Specified by:
beforeAddin interfaceLifeCycleAwareChannelHandler- Throws:
java.lang.Exception
-
beforeRemove
public void beforeRemove(ChannelHandlerContext ctx) throws java.lang.Exception
- Specified by:
beforeRemovein interfaceLifeCycleAwareChannelHandler- Throws:
java.lang.Exception
-
afterRemove
public void afterRemove(ChannelHandlerContext ctx) throws java.lang.Exception
- Specified by:
afterRemovein interfaceLifeCycleAwareChannelHandler- Throws:
java.lang.Exception
-
-