commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trevor Miller" <ub3rg...@gmail.com>
Subject [httpclient]
Date Wed, 09 Aug 2006 09:13:45 GMT
Hi All,

I'm using HttpClient to download a simple XML document from a jsp
page, I want to be able to show a progress bar if it takes a long
time.

In order to test this, i write a simple JSP with some calls to
Thread.sleep to simulate network latency and used the following code:

        HttpClient client = new HttpClient();
        HttpMethod method = new
GetMethod("http://localhost:8084/TestHTTPWeb/index.jsp");
        try {
            client.executeMethod (method);
            System.out.println ("Connected, reading response.");
            InputStream in = new BufferedInputStream(
                          new ProgressMonitorInputStream(
                                  this,
                                  "Reading",
                                  method.getResponseBodyAsStream ()));
        } catch (IOException ex) {
            ex.printStackTrace();
        }

Needless to say, this does not work since by the time
method.getResponseBodyAsStream () is called, the data has already been
transferred.

Is there a way to do this?

Regards,
Trevor Miller

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message