hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Om Narayan" <...@hotmail.com>
Subject Questions related to the use of HttpClient classes
Date Thu, 05 Jun 2003 19:59:14 GMT
Please validate my understanding of how HttpClient and the other classes
work together.

1. When I do "httpclient = new HttpClient", the object is created by default
with the SimpleHttpConnectionManager.
2. I create "post = new PostMethod(url)" and call
httpclient.executeMethod(post). At this point httpclient takes the url in
the post object and using the SimpleHttpConnectionManager, creates a
HttpConnection object.  This connection is retained by the
SimpleHttpConnectionManager and (possibly?) reused.
3. After connection is established, data is posted, and the result
retrieved.
4. I do post.releaseConnection().  Does the connection get closed at this
point? Is the HttpConnection object still around? What do I need to do if  I
had wanted to have the connection stay alive (because it takes time to
re-establish the connection)?
5. Is post.recycle() related to connection in any way? What is the purpose
of this? Is PostMethod ctor an expensive operation?

6. SimpleHttpConnectionManager doc says "This manager makes no attempt to
provide exclusive access to the contained HttpConnection". Does this mean
that calling httpclient.execute() method in this case is not thread-safe?

7. If I wanted to use "connection pooling" should I be using
MultiThreadedHttpConnectionManager instead?  Or do I need to implement my
own pooling?

I am sure I have other questions, but this will do for now. :)
Thanks.

Om.

Mime
View raw message