Use GZIP in the Factorial example
This commit is contained in:
parent
8b7efa5db4
commit
1dc34f0bfd
@ -21,6 +21,7 @@ import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineFactory;
|
||||
import org.jboss.netty.handler.codec.compression.ZlibDecoder;
|
||||
import org.jboss.netty.handler.codec.compression.ZlibEncoder;
|
||||
import org.jboss.netty.handler.codec.compression.ZlibWrapper;
|
||||
|
||||
/**
|
||||
* Creates a newly configured {@link ChannelPipeline} for a client-side channel.
|
||||
@ -42,8 +43,9 @@ public class FactorialClientPipelineFactory implements
|
||||
public ChannelPipeline getPipeline() throws Exception {
|
||||
ChannelPipeline pipeline = pipeline();
|
||||
|
||||
pipeline.addLast("a", new ZlibEncoder());
|
||||
pipeline.addLast("b", new ZlibDecoder());
|
||||
// Enable stream compression (you can comment out if unnecessary)
|
||||
pipeline.addLast("deflater", new ZlibEncoder(ZlibWrapper.GZIP));
|
||||
pipeline.addLast("inflater", new ZlibDecoder(ZlibWrapper.GZIP));
|
||||
|
||||
// Add the number codec first,
|
||||
pipeline.addLast("decoder", new BigIntegerDecoder());
|
||||
|
@ -21,8 +21,7 @@ import org.jboss.netty.channel.ChannelPipeline;
|
||||
import org.jboss.netty.channel.ChannelPipelineFactory;
|
||||
import org.jboss.netty.handler.codec.compression.ZlibDecoder;
|
||||
import org.jboss.netty.handler.codec.compression.ZlibEncoder;
|
||||
import org.jboss.netty.handler.logging.LoggingHandler;
|
||||
import org.jboss.netty.logging.InternalLogLevel;
|
||||
import org.jboss.netty.handler.codec.compression.ZlibWrapper;
|
||||
|
||||
/**
|
||||
* Creates a newly configured {@link ChannelPipeline} for a server-side channel.
|
||||
@ -39,10 +38,9 @@ public class FactorialServerPipelineFactory implements
|
||||
public ChannelPipeline getPipeline() throws Exception {
|
||||
ChannelPipeline pipeline = pipeline();
|
||||
|
||||
pipeline.addLast("l", new LoggingHandler(InternalLogLevel.INFO, true));
|
||||
|
||||
pipeline.addLast("a", new ZlibEncoder());
|
||||
pipeline.addLast("b", new ZlibDecoder());
|
||||
// Enable stream compression (you can comment out if unnecessary)
|
||||
pipeline.addLast("deflater", new ZlibEncoder(ZlibWrapper.GZIP));
|
||||
pipeline.addLast("inflater", new ZlibDecoder(ZlibWrapper.GZIP));
|
||||
|
||||
// Add the number codec first,
|
||||
pipeline.addLast("decoder", new BigIntegerDecoder());
|
||||
|
Loading…
Reference in New Issue
Block a user