hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From helxsz <hel...@yahoo.com.cn>
Subject Re: trying to receive a http streaming, chunked, but how to make it?
Date Fri, 23 Apr 2010 05:55:51 GMT

Sorry , could you elaborate a bit more?  

olegk wrote:
> 
> 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
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/trying-to-receive-a-http-streaming%2C-chunked%2C-but-how-to-make-it--tp28287857p28337510.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Mime
View raw message