Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 86516 invoked from network); 3 Feb 2010 11:49:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Feb 2010 11:49:57 -0000 Received: (qmail 65909 invoked by uid 500); 3 Feb 2010 11:49:57 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 65845 invoked by uid 500); 3 Feb 2010 11:49:57 -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 65835 invoked by uid 99); 3 Feb 2010 11:49:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2010 11:49:57 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ben_cox_21@hotmail.com designates 65.55.90.24 as permitted sender) Received: from [65.55.90.24] (HELO snt0-omc1-s13.snt0.hotmail.com) (65.55.90.24) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2010 11:49:48 +0000 Received: from SNT117-W56 ([65.55.90.8]) by snt0-omc1-s13.snt0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 3 Feb 2010 03:49:26 -0800 Message-ID: X-Originating-IP: [195.212.29.75] From: Ben Cox To: Subject: RE: HTTP Trailers in HttpClient 4.0.1 Date: Wed, 3 Feb 2010 11:49:26 +0000 Importance: Normal In-Reply-To: <1265193685.7256.56.camel@ubuntu> References: ,<1265193685.7256.56.camel@ubuntu> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 03 Feb 2010 11:49:26.0884 (UTC) FILETIME=[EFE6CA40:01CAA4C6] Oleg=2C Thanks for your response. That's interesting - as you say=2C using trailers= is somewhat of an edge case=2C though there's something to be said for usi= ng them as part of mashup-type applications in which data may be being sent= over an extended period=2C so some state may be unknown at the beginning o= f transmission. I'd spotted the ChunkedInputStream before=2C but was unable to use it. Whic= h InputStream are you referring to? I tried casting entity.getContent()=2C = but that's a ByteArrayInputStream=2C and I can't find an InputStream for th= e response itself. Thanks=2C Ben ---------------------------------------- > Subject: Re: HTTP Trailers in HttpClient 4.0.1 > From: olegk@apache.org > To: httpclient-users@hc.apache.org > Date: Wed=2C 3 Feb 2010 11:41:25 +0100 > > On Tue=2C 2010-02-02 at 21:07 +0000=2C Ben Cox wrote: >> Hi all=2C >> >> I'm testing out using chunked encoding with trailing headers at the mome= nt=2C but seem to be having some problems getting the HttpClient to find th= e trailers. My code looks like this: >> >> /***************************************************************/ >> >> HttpClient httpClient =3D new DefaultHttpClient()=3B >> HttpGet httpGet =3D new HttpGet(url)=3B >> >> // Tell the server that we can deal with trailers >> httpGet.addHeader("TE"=2C "trailers")=3B >> >> // Get the response >> HttpResponse response =3D httpClient.execute(httpGet)=3B >> >> // Print out all the headers we have >> for (Header aHeader : response.getAllHeaders()) { >> System.out.println(aHeader.getName() + ": " + aHeader.getValue())=3B >> } >> >> /***************************************************************/ >> >> The resultant document is transferred in around 100 chunks. >> >> I get all the other trailers I might expect to be printed=2C including t= he "Trailer: Mytrailer" one that describes what trailers I should I expect.= However=2C I don't get "Mytrailer" at all=2C though I can see it on the wi= re if I use Wireshark. >> >> I noticed in the 3.x documentation there seems to be a lot more info abo= ut chunked encoding and trailers/footers. However=2C there's not so much in= the 4.0.1 documentation. Is this not supported any more=2C or just more in= tegrated into normal headers and I've got something wrong? >> >> Any help is much appreciated. >> >> Thanks=2C >> Ben >> > > Hi Ben > > I personally have never seen trailers/footers used in any of the > real-world application. This seems to be no convincing use case for > them. This is the reason trailing headers in Httpclient 4.0 can only be > accessed by casting the response InputStream to ChunkInputStream and > calling ChunkInputStream#getFooters once the end of the stream has been > reached. > > Hope this helps > > Oleg > > > > --------------------------------------------------------------------- > To unsubscribe=2C e-mail: httpclient-users-unsubscribe@hc.apache.org > For additional commands=2C e-mail: httpclient-users-help@hc.apache.org > =20 _________________________________________________________________ Send us your Hotmail stories and be featured in our newsletter http://clk.atdmt.com/UKM/go/195013117/direct/01/= --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org