package org.xins.common.servlet.container;
import static org.jboss.netty.channel.Channels.pipeline;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.handler.codec.http.HttpContentCompressor;
import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
import org.jboss.netty.handler.codec.http.HttpResponseEncoder;
public class DefaultNettyServletPipelineFactory implements ChannelPipelineFactory {
private NettyServletHandler servletHandler;
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = pipeline();
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("encoder", new HttpResponseEncoder());
pipeline.addLast("deflater", new HttpContentCompressor());
pipeline.addLast("handler", servletHandler);
return pipeline;
}
public NettyServletHandler getServletHandler() {
return servletHandler;
}
public void setServletHandler(NettyServletHandler servletHandler) {
this.servletHandler = servletHandler;
}
}