commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Randy Paries" <randy.par...@unitnet.com>
Subject Can I use HttpClient to calculate the size of a web page?
Date Fri, 23 Sep 2005 15:36:18 GMT
Hello,
 
I am looking for some suggestions.
 
I have a application that a user uses an in-browser editor and then saves
their page to a servlet which creates the html file.
 
I need to determine how large this page is (ie how long it would take to
download for a dialup user).  So image size needs to be calculated etc.
 
So i was thinking how right after saving the file, i would have the servlet
use a httpClient and re-read it.
 
    //abbreviated version //
            HttpClient client = new HttpClient();
            method = new GetMethod(url);
            int statusCode = client.executeMethod(method);
            byte[] responseBody = method.getResponseBody();
            return responseBody.length;

but this really just returns the html text
 
Can httpClient do what i want? or does any one have a great idea for me?
 
Thanks
Randy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message