@ChannelHandler.Sharable
public class TextWebsocketDecoder
extends io.netty.handler.codec.MessageToMessageDecoder<io.netty.handler.codec.http.websocketx.TextWebSocketFrame>
TextWebSocketFrame to an
Event. The incoming data is expected to be a JSon string
representation of an Event object. This class uses ObjectMapper to do
the decoding to DefaultEvent. If the incoming event is of type
Events.NETWORK_MESSAGE then it will be converted to
Events.SESSION_MESSAGE.| Modifier and Type | Field and Description |
|---|---|
private io.netty.util.AttributeKey<Class<? extends Event>> |
eventClass
This will be put into the
ChannelHandlerContext the first time
attr method is invoed on it. |
private org.codehaus.jackson.map.ObjectMapper |
jackson |
| Constructor and Description |
|---|
TextWebsocketDecoder() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.websocketx.TextWebSocketFrame frame,
List<Object> out) |
org.codehaus.jackson.map.ObjectMapper |
getJackson() |
void |
setJackson(org.codehaus.jackson.map.ObjectMapper jackson) |
acceptInboundMessage, channelReadchannelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredexceptionCaught, handlerAdded, handlerRemovedprotected void decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.websocketx.TextWebSocketFrame frame,
List<Object> out)
throws Exception
decode in class io.netty.handler.codec.MessageToMessageDecoder<io.netty.handler.codec.http.websocketx.TextWebSocketFrame>Exceptionpublic org.codehaus.jackson.map.ObjectMapper getJackson()
public void setJackson(org.codehaus.jackson.map.ObjectMapper jackson)
Copyright © 2013. All Rights Reserved.