Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 44095 invoked from network); 20 Apr 2010 21:03:32 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Apr 2010 21:03:32 -0000 Received: (qmail 24914 invoked by uid 500); 20 Apr 2010 21:03:31 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 24857 invoked by uid 500); 20 Apr 2010 21:03:31 -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 24733 invoked by uid 99); 20 Apr 2010 21:03:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Apr 2010 21:03:30 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [92.42.190.144] (HELO ok2cons2.nine.ch) (92.42.190.144) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Apr 2010 21:03:22 +0000 Received: from [192.168.1.102] (178-83-227-183.dclient.hispeed.ch [178.83.227.183]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ok2cons2.nine.ch (Postfix) with ESMTPSA id 7CC794BA2A2 for ; Tue, 20 Apr 2010 23:03:01 +0200 (CEST) Subject: Re: trying to receive a http streaming, chunked, but how to make it? From: Oleg Kalnichevski To: HttpClient User Discussion In-Reply-To: <28287857.post@talk.nabble.com> References: <28287857.post@talk.nabble.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 20 Apr 2010 23:03:02 +0200 Message-ID: <1271797382.2468.11.camel@ubuntu> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Tue, 2010-04-20 at 06:29 -0700, helxsz wrote: > > I am running a test on apache httpclient, once the httpclient sends to > request to the server, a http streaming connection would be established, and > also invokes a thread, which would sequentially broadcast data to the client > every 2 seconds for 10 times in total > > On the client's side, I can see the connection is running during the long > -polling period, but could not receive any data.. And I am sure it is > streaming and chunked > > public Object handleResponse(HttpResponse response) > { > > HttpEntity entity = response.getEntity(); > > System.out.println("isStreaming:" + response.getEntity().isStreaming()); > // true > System.out.println("isChunked:" + response.getEntity().isChunked()); > // true > System.out.println("isrepeatable:" + > response.getEntity().isRepeatable()); // false > > if (entity != null) { > System.out.println("Response content length: " + > entity.getContentLength()); > BufferedReader reader = new BufferedReader(new > InputStreamReader(entity.getContent())); > while(reader.readLine()!=null) > { > System.out.println(reader.readLine()); > } > } // this doesn't seem to work out > return null; > } > }; > httpclient.execute(httpget, responseHandler); > > I wonder as for receiving data from a http streaming, chunked connection, > probably the solution is to use ChunkedInputStream , but I can't find a > tutorial for this class > > Or if I am wrong , who could help me how to receive data from a > streaming, chunked connection?? > Post wire log of the HTTP session http://hc.apache.org/httpcomponents-client-4.0.1/logging.html Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org