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