*
* @see WebSocketServerHandler#handleHttpRequest(ChannelHandlerContext, org.jboss.netty.handler.codec.http.HttpRequest)
*/
public ChannelPipeline getPipeline() throws Exception
{
ChannelPipeline pipeline = new DefaultChannelPipeline();
if (sslEnabled)
{
SSLEngine engine = context.createSSLEngine();
engine.setUseClientMode(false);
SslHandler handler = new SslHandler(engine);
pipeline.addLast("ssl", handler);
}
if (httpEnabled)
{
pipeline.addLast("http-decoder", new HttpRequestDecoder());
pipeline.addLast("http-encoder", new HttpResponseEncoder());
pipeline.addLast("http-handler", new HttpAcceptorHandler(httpKeepAliveRunnable, httpResponseTime));
}
if (protocol == ProtocolType.CORE)
{
// Core protocol uses it's own optimised decoder
pipeline.addLast("hornetq-decoder", new HornetQFrameDecoder2());
}
else if (protocol == ProtocolType.STOMP_WS)
{
pipeline.addLast("http-decoder", new HttpRequestDecoder());
pipeline.addLast("http-aggregator", new HttpChunkAggregator(65536));
pipeline.addLast("http-encoder", new HttpResponseEncoder());
pipeline.addLast("hornetq-decoder", new HornetQFrameDecoder(decoder));
pipeline.addLast("websocket-handler", new WebSocketServerHandler());
}
else
{
pipeline.addLast("hornetq-decoder", new HornetQFrameDecoder(decoder));
}
pipeline.addLast("handler", new HornetQServerChannelHandler(channelGroup, handler, new Listener()));
return pipeline;
}
};
bootstrap.setPipelineFactory(factory);