Hi Litty, You can do:
EntityUtils.consume(entity); Regards, Jordi On Tue, Oct 25, 2011 at 11:07, Litty Preeth <[email protected]> wrote: > I posted the same issue on stackoverflow: > > http://stackoverflow.com/questions/7723558/apache-httpclient-giving-connection-timeout-after-5-ot-6-hrs > > Someone suggested that I these issue comes if the response is not fully > emptied. Also if I enable the wire and header debug for httpclient, I am > not > getting this issue. So may be the root cause is because the response is not > fully drained. I tried the following for every request: > > int statusCode = res.getStatusLine().getStatusCode(); > String reasonPhrase = res.getStatusLine().getReasonPhrase(); > Header[] headers = res.getAllHeaders(); > HashMap<String, String> headerMap = new HashMap<String, String>(); > if (headers != null) { > for (Header header : headers) { > if (header != null) { > headerMap.put(header.getName(), header.getValue()); > } > } > } > HttpEntity resEntity = res.getEntity(); > if (resEntity != null && resEntity.getContentLength() > 0) { > ByteArrayOutputStream os = new ByteArrayOutputStream(); > resEntity.writeTo(os); > resStr = os.toString(); > } > > But I am still getting the issue if I don't turn on debug logging. So can > anybody suggest how to empty a response? > > Regards, > Litty Preeth > > On Thu, Oct 20, 2011 at 1:47 AM, Vasile Alin <[email protected] > >wrote: > > > On 18 October 2011 08:05, Litty <[email protected]> wrote: > > > > > I am able to connect to the same URL from the same machine using a > > browser. > > > So I don't think the issue is with web server. > > > > > > > This doesn't prove that there are no issues with the web server. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > >
