AeroGear Netty SockJS Codec 0.11.0

org.jboss.aerogear.io.netty.handler.codec.sockjs.transport
Class AbstractSendTransport

java.lang.Object
  extended by io.netty.channel.ChannelHandlerAdapter
      extended by io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>
          extended by org.jboss.aerogear.io.netty.handler.codec.sockjs.transport.AbstractSendTransport
All Implemented Interfaces:
io.netty.channel.ChannelHandler
Direct Known Subclasses:
JsonpSendTransport, XhrSendTransport

public abstract class AbstractSendTransport
extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>

A common base class for SockJS transports that send messages to a SockJS service.


Nested Class Summary
 
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable, io.netty.channel.ChannelHandler.Skip
 
Field Summary
protected  SockJsConfig config
           
 
Constructor Summary
protected AbstractSendTransport(SockJsConfig config)
           
 
Method Summary
 void messageReceived(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest request)
           
abstract  void respond(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest request)
          Allows concrete subclasses to very how they will respond after a message has been sent to the target SockJS service.
protected  void respond(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpVersion httpVersion, io.netty.handler.codec.http.HttpResponseStatus status, String message)
           
 
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
 
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
bind, channelActive, channelInactive, channelReadComplete, channelRegistered, channelWritabilityChanged, close, connect, disconnect, exceptionCaught, flush, handlerAdded, handlerRemoved, isSharable, read, userEventTriggered, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected final SockJsConfig config
Constructor Detail

AbstractSendTransport

protected AbstractSendTransport(SockJsConfig config)
Method Detail

messageReceived

public void messageReceived(io.netty.channel.ChannelHandlerContext ctx,
                            io.netty.handler.codec.http.FullHttpRequest request)
                     throws Exception
Specified by:
messageReceived in class io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>
Throws:
Exception

respond

public abstract void respond(io.netty.channel.ChannelHandlerContext ctx,
                             io.netty.handler.codec.http.FullHttpRequest request)
                      throws Exception
Allows concrete subclasses to very how they will respond after a message has been sent to the target SockJS service. Different transport protocols require different responses, for example jsonp_send requires an OK response while xhr_send NO_CONTENT.

Parameters:
ctx - the current ChannelHandlerContext.
request - the http request.
Throws:
Exception - if a failure occurs while trying to respond.

respond

protected void respond(io.netty.channel.ChannelHandlerContext ctx,
                       io.netty.handler.codec.http.HttpVersion httpVersion,
                       io.netty.handler.codec.http.HttpResponseStatus status,
                       String message)

AeroGear Netty SockJS Codec 0.11.0

Copyright © 2014 JBoss by Red Hat. All Rights Reserved.