Folks,
I have hacked up a simple implementation of the GZIP content compression
in order to demonstrate how to implement a content encoding using the
existing interceptor framework in HttpCore.
Source code in the 'contrib' package:
http://svn.apache.org/repos/asf/jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/compress/
Append the RequestAcceptEncoding and ResponseGzipUncompress interceptors
to the standard list of interceptors to enable the content decompression
on the client side
Sample app:
http://svn.apache.org/repos/asf/jakarta/httpcomponents/trunk/http-core/src/examples/org/apache/http/examples/ElementalHttpGet.java
<code>
// Required protocol interceptors
httpexecutor.addInterceptor(new RequestContent());
httpexecutor.addInterceptor(new RequestTargetHost());
// Recommended protocol interceptors
httpexecutor.addInterceptor(new RequestConnControl());
httpexecutor.addInterceptor(new RequestUserAgent());
httpexecutor.addInterceptor(new RequestExpectContinue());
// Optional content compression
httpexecutor.addInterceptor(new RequestAcceptEncoding());
httpexecutor.addInterceptor(new ResponseGzipUncompress());
</code>
Prepend the ResponseGzipCompress to the standard list of interceptors to
enable the content compression on the server side.
Sample app:
http://svn.apache.org/repos/asf/jakarta/httpcomponents/trunk/http-core/src/examples/org/apache/http/examples/ElementalHttpServer.java
<code>
// Optional content compression
fileServiceHandler.addInterceptor(new ResponseGzipCompress());
// Required protocol interceptors
fileServiceHandler.addInterceptor(new ResponseDate());
fileServiceHandler.addInterceptor(new ResponseServer());
fileServiceHandler.addInterceptor(new ResponseContent());
fileServiceHandler.addInterceptor(new ResponseConnControl());
</code>
Feedback, comments, critique welcome.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]