Apache HTTPClient returns an empty page

Posted by mariosangiorgio on Stack Overflow See other posts from Stack Overflow or by mariosangiorgio
Published on 2010-05-29T20:25:13Z Indexed on 2010/05/29 20:32 UTC
Read the original article Hit count: 178

Filed under:
|

Hi, I am using the Apache HTTPClient for Java and I'm facing a really strange issue. Sometimes when I try to get a dynamically generated page it returns its actual content, but other times (with another parameter) all I get is a short sequence of \t,\r and \n.

How could I track what's going on on the different cases in order to find where is the bug?

My usage of the library is pretty straightforward, all I do is this few calls on an initialized HTTPClient object:

String content = "/pageIwant.jsp?parameter=10101010";
HttpGet request = new HttpGet(content);
HttpResponse response = client.execute(targetHost, request);
HttpEntity entity = response.getEntity();
String page = EntityUtils.toString(entity);

© Stack Overflow or respective owner

Related posts about java

Related posts about httpclient