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??
Thank you in advance
--
View this message in context:
http://old.nabble.com/trying-to-receive-a-http-streaming%2C-chunked%2C-but-how-to-make-it--tp28287857p28287857.html
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]