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 boolean
allowExtensions
private java.lang.String
subprotocols
private java.lang.String
websocketPath
-
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 void
afterAdd(ChannelHandlerContext ctx)
void
afterRemove(ChannelHandlerContext ctx)
void
beforeAdd(ChannelHandlerContext ctx)
void
beforeRemove(ChannelHandlerContext ctx)
void
exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
Invoked when an exception was raised by an I/O thread or aChannelHandler
.(package private) static ChannelHandler
forbiddenHttpRequestResponder()
(package private) static WebSocketServerHandshaker
getHandshaker(ChannelHandlerContext ctx)
void
messageReceived(ChannelHandlerContext ctx, MessageEvent e)
Invoked when a message object (e.g:ChannelBuffer
) was received from a remote peer.(package private) static void
setHandshaker(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:
afterAdd
in interfaceLifeCycleAwareChannelHandler
- Throws:
java.lang.Exception
-
messageReceived
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws java.lang.Exception
Description copied from class:SimpleChannelUpstreamHandler
Invoked when a message object (e.g:ChannelBuffer
) was received from a remote peer.- Overrides:
messageReceived
in classSimpleChannelUpstreamHandler
- Throws:
java.lang.Exception
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws java.lang.Exception
Description copied from class:SimpleChannelUpstreamHandler
Invoked when an exception was raised by an I/O thread or aChannelHandler
.- Overrides:
exceptionCaught
in 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:
beforeAdd
in interfaceLifeCycleAwareChannelHandler
- Throws:
java.lang.Exception
-
beforeRemove
public void beforeRemove(ChannelHandlerContext ctx) throws java.lang.Exception
- Specified by:
beforeRemove
in interfaceLifeCycleAwareChannelHandler
- Throws:
java.lang.Exception
-
afterRemove
public void afterRemove(ChannelHandlerContext ctx) throws java.lang.Exception
- Specified by:
afterRemove
in interfaceLifeCycleAwareChannelHandler
- Throws:
java.lang.Exception
-
-