[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-users
Subject:    Re: Servlet talking to servlet talking to servlet
From:       Roland Weber <http-async () dubioso ! net>
Date:       2007-03-31 16:25:27
Message-ID: 460E8B77.1040502 () dubioso ! net
[Download RAW message or body]

Hello Richard,

> I have a situation where I have Servlet 1 doing a
> HttpClient.exec(PostMethod) to Servlet 2 doing a
> HttpClient.exec(PutMethod) to servlet 3.  So the PostMethed doesn't
> return until the PutMethod returns.  All are using the same instance of
> HttpClient.  I am NOT using the MultiThreadedHttpConnectionManager.  Is
> this supposed to work?

No it's not, if you mean that you are using SimpleHttpConnectionManager.
If your servlet is calling another servlet in the same servlet container,
you should use the Servlet API to pass on the request:

http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/RequestDispatcher.html

> It works on Windows, but doesn't on Linux.  On linux, it freezes on the
> second call HttpClient.exec(PutMethod).  Should I be using the
> MultiThreadedHttpConnectionManager?

Yes. Though it shouldn't freeze with the SimpleHttpConnectionManager.
Rather, the first connection should be terminated when it is allocated
a second time. You should be seeing warnings in the log. Are you sure
you are using the same version of HttpClient in both environments?
May there be differences in the servlet container's thread handling?

> I think I should, but I don't know why it works on Windows.

Pure luck. Or rather coincidence, because it is not luck
if buggy code _seems_ to work.

cheers,
  Roland



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic