hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexis (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (HTTPCLIENT-1218) Serializibility of HttpCacheEntry and BufferedHeader
Date Mon, 30 Jul 2012 20:47:34 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Alexis closed HTTPCLIENT-1218.

    Resolution: Not A Problem

No need to change HttpCacheEntry, it can be done during post-processing of the response:

         AbstractHttpClient abstractHttpClient = new DefaultHttpClient();
         abstractHttpClient.addResponseInterceptor( new HttpResponseInterceptor() {

            public void process(HttpResponse response, HttpContext context) throws HttpException,
IOException {
                // Replace instances of {@link BufferedHeader} with ones of {@link BasicHeader}.
                for (Header header: httpResponse.getAllHeaders()) {
                    if (header instanceof BufferedHeader) {
                        httpResponse.addHeader(new BasicHeader(header.getName(), header.getValue()));

Sorry I should have talked to my duck longer.
> Serializibility of HttpCacheEntry and BufferedHeader
> ----------------------------------------------------
>                 Key: HTTPCLIENT-1218
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1218
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>            Reporter: Alexis
>              Labels: httpclient-cache
>         Attachments: httpCacheEntry.patch
> Current serialization of HttpCacheEntry relies on java.io.Serializable. But not everybody
wants to rely on this RPC format, since there are better alternatives -> Kryo for example.
I tested it: once the class is registered in Kryo, serialization is 10 times faster and takes
up 4 times less bytes.
> Instances of BufferedHeader (which implements FormattedHeader) in the header group are
not serialization friendly: Factory is slow and lot's of memory is wasted to generate parsers.
> A header is a plain POJO with a name and a value, nothing more. I'm not quite sure of
the point of the FormattedHeader interface.
> - Quick fix is replacing all BufferedHeader with BasicHeader instances before serializing.
> - Long term idea suggestion: If the API wants to keep FormattedHeader would it be possible
to allow the API user to disable it?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message