it seems for some URL, stream retrieved by HttpClient is different for different requests,but in other ones this not happens. For example it happens for URL like http://online.wsj.com/article/SB10001424052748703882304575464930336307358.html and http://online.wsj.com/article/SB10001424052748703369704575461602043868916.html . Khosro.
________________________________ From: Khosro Asgharifard <[email protected]> To: [email protected] Sent: Sat, September 4, 2010 12:20:25 AM Subject: GetMethod returns differents stream length on the same URL in different request Hi, I use HttpClient 3.1. I use the following code : GetMethod httpGet; protected HttpClient client; client = new HttpClient(new MultiThreadedHttpConnectionManager()); httpGet = new GetMethod(url); int statusCode = client.executeMethod(httpGet); if (statusCode == HttpStatus.SC_OK) { InputStream is = httpGet.getResponseBodyAsStream(); net.htmlparser.jericho.Source source = new Source(convert(document1)); numOfElemets = source.getAllElements().size(); System.out.println("numOfElemets " + numOfElemets); } When i put the above code in for loop ,it prints different number of elements in each loop(sometimes the same not always). It seems the stream that retrieves by GetMethod is different in each request for the same URL. It is a big problem for me.Do you know why this happens? Best Regards. Khosro.
