Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 65913 invoked from network); 13 Dec 2004 22:15:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 13 Dec 2004 22:15:07 -0000 Received: (qmail 22813 invoked by uid 500); 13 Dec 2004 22:15:07 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 22795 invoked by uid 500); 13 Dec 2004 22:15:07 -0000 Mailing-List: contact httpclient-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: "HttpClient User Discussion" Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-user@jakarta.apache.org Received: (qmail 22779 invoked by uid 99); 13 Dec 2004 22:15:06 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from Unknown (HELO topexm01.sbc) (12.108.131.35) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 13 Dec 2004 14:15:03 -0800 Received: by topexm01.sbc with Internet Mail Service (5.5.2653.19) id ; Mon, 13 Dec 2004 16:14:24 -0600 Message-ID: From: Gustavo Hexsel To: 'HttpClient User Discussion' Subject: RE: How to set timeout parameters for a method? Date: Mon, 13 Dec 2004 16:04:48 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I can't, the values are different for each run. The reason is because I have a "general timeout" which includes retrieving and parsing a variable number of pages. []s Gustavo -----Original Message----- From: Jilles van Gurp [mailto:jillesvangurp@gmail.com] Sent: December 13, 2004 2:41 PM To: HttpClient User Discussion Subject: Re: How to set timeout parameters for a method? Don't set the timeouts on the method but on the HttpClient instance. You can use the setConnectionTimeout and setTimeout methods. Jilles van Gurp Gustavo Hexsel wrote: > Greetings, > > does anyone know how to set the timeout parameters (if possible, both >socket and connection) for a particular method? I tried to make an accessor >to the HttpConnection, but as I suspected, it is not created until you try >to execute the method, and by then is too late, as both connection and first >read already happened. > I tried to do something like this: > > method.getParams().setIntParameter("http.socket.timeout", >remainingTime); // in my logs, remaining time is about 300s > method.getParams().setIntParameter("http.connection.timeout", >remainingTime); > > Even though "connection timeout" is not supposed to be a valid parameter >for the method. The log indicated that the parameters were set, but the >values remained the same as the defaults set before, and I get a >"SocketTimeout: Read timed out" after about 10s (my default param setting). > Similarly, even if the first "read()" doesn't time out, I've set the >connection timeouts to the remaining time (over 280s by then), but still >times out in the default values (10s). This is the code I'm using: > > HttpConnectionParams connParams = >method.getResponseConnection().getParams(); // I just provided an accessor >here > connParams.setConnectionTimeout(remainingTime); > connParams.setSoTimeout(remainingTime); > > > Any ideas? > > > Thanks a lot, > > Gustavo > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: httpclient-user-help@jakarta.apache.org > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org