Hi Oleg, I want the stream to be open since i passing the response i receive to another method, which parses the stream to do additional work....hence i want it to be open. Later we are explcitly closing the stream...
Here is my code snippet :: HttpPool : public void init() { ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(); mgr.setDefaultMaxPerRoute(MAX_CONNECTION_PERHOST); mgr.setMaxTotal(HTTP_CONNECTIONPOOL_SIZE); mgr.closeIdleConnections(CONNECTION_IDLE_TIME*1000L, TimeUnit.MINUTES); client = new DefaultHttpClient(mgr); // client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpRequestRetryHandler(1,false)); client.getParams().setParameter(HttpConnectionParams.SO_TIMEOUT,new Integer(SO_TIMEOUT*60*1000)); } Code which uses this : HttpPost postMethod = createPostMethod(PropertyHandler.getStringProperty("URL")); try { HttpEntity requestEntity = new StringEntity(wrdJaxbString); // This is an XML marshlled to String postMethod.setEntity(requestEntity); HttpResponse status = client.execute(postMethod); /* Does not work :( */ EofSensorWatcher watcher = new BasicEofSensorWatcher(new BasicPooledConnAdapter(httpConnectionPoolMgr.getMgr(), new BasicPoolEntry (new DefaultClientConnectionOperator(new SchemeRegistry()), new HttpRoute(new HttpHost("hostname")))) , false ); EofSensorInputStream result = new EofSensorInputStream(status.getEntity().getContent(), watcher); /* Does not work :( */ response = status.getEntity().getContent(); } catch (IOException e) {} finally { postMethod.abort(); } return response; This is a REST call, the response is sent to another module for further processing of the stream olegk wrote: > > On Wed, 2011-04-20 at 06:00 -0700, Donald Fernandes wrote: >> I have recently moved from Httpclient 3.1 to HttpClient 4.2, mainly to >> resolve the inputstream autoclose problem. I need help in creating the >> EofSensorInputStream.. >> >> I have a http connection pool amanager using ThreadSafeClientConnManager >> using.. >> >> when i post an url and get the response using getEntity().getContent() i >> believe this method by default closes the stream. and to override this we >> need to use the EofSensorInputStream >> > > Donald > > I am not sure I understand the problem. > > What is it _exactly_ you are trying to do and why do you need to prevent > the content stream from being closed? What is the requirement that > drives this? > > Oleg > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org > For additional commands, e-mail: httpclient-users-h...@hc.apache.org > > > -- View this message in context: http://old.nabble.com/help-with-EofSensorInputStream..-tp31441020p31441208.html Sent from the HttpClient-User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org