forked from linkedin/rest.li
-
Notifications
You must be signed in to change notification settings - Fork 0
Compression
Karan Parikh edited this page Oct 15, 2013
·
16 revisions
Please take a look at: https://github.com/linkedin/rest.li/blob/master/examples/guice-server/server/src/main/java/com/example/fortune/inject/FortunesGuiceServletConfig.java to see how the server has to be configured.
In particular
FilterChain filterChain = FilterChains.create(
new ServerCompressionFilter(new EncodingType[] { EncodingType.SNAPPY }),
new SimpleLoggingFilter());This instantiates a Rest.li server that supports SNAPPY compression. To support SNAPPY and GZIP for example, you would have to instantiate your server as follows:
FilterChain filterChain = FilterChains.create(
new ServerCompressionFilter(new EncodingType[] { EncodingType.SNAPPY, EncodingType.GZIP }),
new SimpleLoggingFilter());When we say that a server supports a particular algorithm for compression, it means that the server can compress and decompress using that algorithm. When to compress and decompress is governed by the client request.