hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alfredo Marchini <i...@alfredomarchini.it>
Subject Asynchronous GetMethod with getResponseBodyAsStream()
Date Fri, 18 Dec 2009 10:04:12 GMT
Hi all,
I need to find a solution for calling httpclient.executeMethod in
non-blocking mode, so I can retrieve data with
getResponseBodyAsStream() without waiting for the end of the execution
of the method.

The scenario is the following:
I write in PHP a page that with flush method output some strings that I
need to capture while the page are downloading.

I write in Java this code:

httpClient.executeMethod(method);
BufferedReader reader = new BufferedReader(new
InputStreamReader(method.getResponseBodyAsStream()));
String line = null;

while((line = reader.readLine()) != null) {
    System.out.println(line);
}

This code does not resolve my problem, because the executeMethod blocks
until all data is downloaded.
I need that executeMethod don't block, so I can retrieve output while
executeMethod capture it.
Is there a way to do this?
Thank you very much.
Alfredo


---------------------------------------------------------------------
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