Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C1DD1094A for ; Thu, 9 Jan 2014 09:07:06 +0000 (UTC) Received: (qmail 16396 invoked by uid 500); 9 Jan 2014 09:06:55 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 16348 invoked by uid 500); 9 Jan 2014 09:06:46 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 16337 invoked by uid 99); 9 Jan 2014 09:06:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jan 2014 09:06:41 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [217.150.250.48] (HELO kalnich.nine.ch) (217.150.250.48) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jan 2014 09:06:35 +0000 Received: from [192.168.42.78] (unknown [213.55.184.225]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by kalnich.nine.ch (Postfix) with ESMTPSA id BF63FB80052 for ; Thu, 9 Jan 2014 10:06:14 +0100 (CET) Message-ID: <1389258372.19295.9.camel@ubuntu> Subject: Re: adding interceptors on per request basis (was Re: Unable to see response encoding even through "Content-Encoding" header is present) From: Oleg Kalnichevski To: HttpClient User Discussion Date: Thu, 09 Jan 2014 10:06:12 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Wed, 2014-01-08 at 18:29 -0800, Gaurav Kumar wrote: > Thanks! I am now able to see content-encoding. However, the example I > followed showed how to add interceptors on global client instance level - > is there a way I can add interceptor on per-request basis? > > Protocol interceptors are meant for cross-cutting aspects that apply to all messages processed by the same protocol processor. They make no sense on per request basis. If you want full control over content encoding on per request basis then you should disable automatic content decompression. Oleg > On Wed, Jan 8, 2014 at 8:11 AM, Oleg Kalnichevski wrote: > > > On Wed, 2014-01-08 at 07:17 -0800, Gaurav Kumar wrote: > > > So what is the best way to figure out what encoding is being used? > > > > > > > By using a protocol interceptor. > > > > Oleg > > > > > On Jan 8, 2014 2:28 AM, "Oleg Kalnichevski" wrote: > > > > > > > > On Wed, 2014-01-08 at 00:04 -0800, Gaurav Kumar wrote: > > > > > Using HttpClient 4.3-beta2. > > > > > > > > > > Have a look at this httpclient header log (headers only) > > > > > http://pastebin.com/kWk6rbJ2 > > > > > > > > > > As you can see, the server is responding with Content-Encoding > > header. > > > > > > > > > > Now, refer to this Java code - http://pastebin.com/i7nhAksb - it > > simple > > > > > prints the headers and a message if content encoding cannot be found. > > > The > > > > > output of this code is here- http://pastebin.com/WtkuBsZb > > > > > > > > > > > > > > > My question is - why HttpClient is not able to see content encoding > > even > > > > > though it's header log shows it got the header from server? > > > > > > > > > > > > > Content-Length, Content-Encoding, Content-MD5 headers are removed by > > > > ResponseContentEncoding as they no longer agree with the properties of > > > > automatically decompressed response entity. > > > > > > > > Oleg > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > > > > For additional commands, e-mail: httpclient-users-help@hc.apache.org > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > > For additional commands, e-mail: httpclient-users-help@hc.apache.org > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org