Class WebSocketServerHandler
- java.lang.Object
-
- org.jboss.netty.channel.SimpleChannelUpstreamHandler
-
- org.jboss.netty.example.http.websocketx.server.WebSocketServerHandler
-
- All Implemented Interfaces:
ChannelHandler
,ChannelUpstreamHandler
public class WebSocketServerHandler extends SimpleChannelUpstreamHandler
Handles handshakes and messages
-
-
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 WebSocketServerHandshaker
handshaker
private static java.lang.String
WEBSOCKET_PATH
-
Constructor Summary
Constructors Constructor Description WebSocketServerHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
Invoked when an exception was raised by an I/O thread or aChannelHandler
.private static java.lang.String
getWebSocketLocation(HttpRequest req)
private void
handleHttpRequest(ChannelHandlerContext ctx, HttpRequest req)
private void
handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame)
void
messageReceived(ChannelHandlerContext ctx, MessageEvent e)
Invoked when a message object (e.g:ChannelBuffer
) was received from a remote peer.private static void
sendHttpResponse(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res)
-
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete
-
-
-
-
Field Detail
-
WEBSOCKET_PATH
private static final java.lang.String WEBSOCKET_PATH
- See Also:
- Constant Field Values
-
handshaker
private WebSocketServerHandshaker handshaker
-
-
Method Detail
-
messageReceived
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
Description copied from class:SimpleChannelUpstreamHandler
Invoked when a message object (e.g:ChannelBuffer
) was received from a remote peer.- Overrides:
messageReceived
in classSimpleChannelUpstreamHandler
-
handleHttpRequest
private void handleHttpRequest(ChannelHandlerContext ctx, HttpRequest req)
-
handleWebSocketFrame
private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame)
-
sendHttpResponse
private static void sendHttpResponse(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res)
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
Description copied from class:SimpleChannelUpstreamHandler
Invoked when an exception was raised by an I/O thread or aChannelHandler
.- Overrides:
exceptionCaught
in classSimpleChannelUpstreamHandler
-
getWebSocketLocation
private static java.lang.String getWebSocketLocation(HttpRequest req)
-
-