HttpClient initialization, when/where?

2004-05-12 Thread Cabbar Duzayak
Hi, I will be writing a gateway which will invoke URLs in behalf of several threads and they will return the content. Each thread needs to invoke different URLs with different context (cookies, etc). It looks like right way of doing this is to instantiate the HttpClient once with

Re: HttpClient initialization, when/where?

2004-05-12 Thread Roland Weber
Hello, you need one HttpState for each thread, since the cookies are stored there. Creating a new state for each request will not work, unless the threads manage the cookies themselves. The HttpClient is associated with a connection pool. If you require independently configured connection pools

RE: HttpClient initialization, when/where?

2004-05-12 Thread Kalnichevski, Oleg
Duzayak (I hope I got your name right), You can create an instance of the HttpState class per thread and pass the respective HttpState object along with the HTTP method to be executed: // shared by all the worker threads HttpConnectionManager connman = new MultiThreadedHttpConnectionManager();

DO NOT REPLY [Bug 28728] - HttpUrl does not accept unescaped passwords

2004-05-12 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://issues.apache.org/bugzilla/show_bug.cgi?id=28728. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.

Re: HttpClient initialization, when/where?

2004-05-12 Thread Cabbar Duzayak
Can you please elaborate a bit how this connection pool and multithreaded HCM work? Cause, given that httpclient will be executed within my thread, why do we need a multithreaded HCM? Also, connection pool is used for sharing connections between threads? How exactly does it work, what does it

Re: HttpClient initialization, when/where?

2004-05-12 Thread Roland Weber
Hi Duzayak (?), the MultiThreadedHCM is called so because it allows for multiple threads to use the same HttpClient. It has to be used if the application is multithreaded. The connection pool limits the number of simultaneous connections, to a particular host and in general. It keeps resource

Cookie Bug?

2004-05-12 Thread Cabbar Duzayak
Hi, I am trying to run the following code for www.google.com: Cookie cookie = initialState.getCookies()[0]; CookieSpec cs = CookiePolicy.getDefaultSpec(); Header h = cs.formatCookieHeader(cookie); Cookie[] cookie2 = cs.parse(cookie.getDomain(), 80, cookie.getPath(), cookie.getSecure(), h); And,

Re: HttpClient initialization, when/where?

2004-05-12 Thread Cabbar Duzayak
Well, This information is more than I need;) Appreciate your help. --- Roland Weber [EMAIL PROTECTED] wrote: Hi Duzayak (?), the MultiThreadedHCM is called so because it allows for multiple threads to use the same HttpClient. It has to be used if the application is multithreaded. The

RE: Cookie Bug?

2004-05-12 Thread Kalnichevski, Oleg
Duzayak, 'Set-Cookie' (request) header is not the same thing as the 'Cookie' (response) header. CookieSpec#formatCookieHeader() method produces a 'Set-Cookie' (request) header, whereas CookieSpec#parse() method is intended to parse 'Cookie' (response) headers I hope this clarifies things a

'Socket closed' exception using

2004-05-12 Thread Preygel, Sofya
Hello, We are trying to use HTTPClient.execute(PostMethod) for sending SOAP requests to Connotate's Web Mining Server (WMS). The requests are sent every 1 minute, and in most cases everything works fine. However, every so often (sometimes way too often!) we are getting the 'Socket closed'

Re: 'Socket closed' exception using

2004-05-12 Thread Michael McGrady
How are you setting your headers? That is sometimes the issue on socket closings. At 10:25 AM 5/12/2004, Preygel, Sofya wrote: Hello, We are trying to use HTTPClient.execute(PostMethod) for sending SOAP requests to Connotate's Web Mining Server (WMS). The requests are sent every 1 minute, and

RE: 'Socket closed' exception using

2004-05-12 Thread Preygel, Sofya
Here it is: PostMethod post = new PostMethod(m_URL); post.setHttp11(false); post.setRequestHeader(Content-Length, Integer.toString(payload.toString().length())); post.setRequestHeader(Content-type, text/xml;charset=utf-8); post.setRequestHeader(Content-type, text/xml;

RE: 'Socket closed' exception using

2004-05-12 Thread Michael McGrady
I meant how do you set the response headers? That is probably where the problem is. At 10:32 AM 5/12/2004, Preygel, Sofya wrote: Here it is: PostMethod post = new PostMethod(m_URL); post.setHttp11(false); post.setRequestHeader(Content-Length,

Re: 'Socket closed' exception using

2004-05-12 Thread Michael Becke
Hi Sofya, There are a couple of possibilities, but it sounds like you are experiencing some connection management issues. If you could, please send some sample code showing how you are using HttpClient, as well as a wire log http://jakarta.apache.org/commons/httpclient/logging.html (just the

@since tags (3.0alpha1 blocker)

2004-05-12 Thread Oleg Kalnichevski
We are almost there. Before we can cut the release, though, there's one tedious and laborious task to be taken care of. To help people identify API changes, the new classes and methods must be properly marked with the @since 3.0 tag. We (I in the first place) have been too undisciplined to put

RE: 'Socket closed' exception using

2004-05-12 Thread Preygel, Sofya
Hi Mike, Here is the code: PostMethod post = new PostMethod(m_URL); post.setHttp11(false); post.setRequestHeader(Content-Length, Integer.toString(payload.toString().length())); post.setRequestHeader(Content-type, text/xml;charset=utf-8);

RE: 'Socket closed' exception using

2004-05-12 Thread Preygel, Sofya
Thank you for your response, Oleg. 1. The application development started when the server application supported only HTTP1.0. 2. The application is multi-threaded, but all HTTP requests are issued from a single thread. It is not the main thread, though, which I hope makes no difference as

Re: 'Socket closed' exception using

2004-05-12 Thread Michael Becke
Hi Sofya, I agree with Oleg, it seems that the server is closing the connection in the middle of a request. Does not this prove that the socket is closed from the application side, i.e from inside the HTTPClient? Or it is possible for the HttpConnection.close() to be called when a closed

Re: @since tags (3.0alpha1 blocker)

2004-05-12 Thread Michael Becke
Docs updated. Mike On May 12, 2004, at 5:53 PM, Oleg Kalnichevski wrote: We are almost there. Before we can cut the release, though, there's one tedious and laborious task to be taken care of. To help people identify API changes, the new classes and methods must be properly marked with the

Persistent HTTPS connections

2004-05-12 Thread Jesus M. Salvo Jr.
Using HttpClient 2.0 JDK 1.4.2_04 on Fedora Is there anything special that I have to do to make use of persistent HTTP(S) connections with HttpClient other than using MultiThreadedHttpConnectionManager ? Basically, what I am doing is the following ( more explanation after the snippet of the