com.sun.jersey.api.client.filter
Class GZIPContentEncodingFilter

java.lang.Object
  extended by com.sun.jersey.api.client.filter.ClientFilter
      extended by com.sun.jersey.api.client.filter.GZIPContentEncodingFilter
All Implemented Interfaces:
ClientHandler

public class GZIPContentEncodingFilter
extends ClientFilter

A GZIP content encoding filter.

The request will be modified to set the Accept-Encoding header to "gzip" if that header has not already been set by the client.

If the request contains an entity and a Content-Encoding header of "gzip" then the entity will be compressed using gzip. If configured, and there does not exist a Content-Encoding header of "gzip" then such a header is added to the request and the entity will be compressed using gzip.

If the response has a Content-Encoding header of "gzip" then then the response entity will be uncompressed using gzip.

Author:
[email protected]

Constructor Summary
GZIPContentEncodingFilter()
          Create a GZIP Content-Encoding filter that compresses the request entity.
GZIPContentEncodingFilter(boolean compressRequestEntity)
          Create a GZIP Content-Encoding filter.
 
Method Summary
 ClientResponse handle(ClientRequest request)
          Handle a HTTP request as a ClientRequest and return the HTTP response as a ClientResponse.
 
Methods inherited from class com.sun.jersey.api.client.filter.ClientFilter
getNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZIPContentEncodingFilter

public GZIPContentEncodingFilter()
Create a GZIP Content-Encoding filter that compresses the request entity.


GZIPContentEncodingFilter

public GZIPContentEncodingFilter(boolean compressRequestEntity)
Create a GZIP Content-Encoding filter.

Parameters:
compressRequestEntity - if true the request entity (if any) is always compressed, otherwise the request entity is compressed only if there exists a Content-Encoding header whose value is "gzip".
Method Detail

handle

public ClientResponse handle(ClientRequest request)
                      throws ClientHandlerException
Description copied from interface: ClientHandler
Handle a HTTP request as a ClientRequest and return the HTTP response as a ClientResponse.

Specified by:
handle in interface ClientHandler
Specified by:
handle in class ClientFilter
Parameters:
request - the HTTP request.
Returns:
the HTTP response.
Throws:
ClientHandlerException - if the client handler fails to process the request or response.


Copyright © 2011 Oracle Corporation. All Rights Reserved.