You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Jens Goerke <Je...@mobilcom.de> on 2007/05/08 13:52:42 UTC
[HttpClient.java] HttpParams
Hi!
When calling HttpClient via Axis the previously set HttpParams (http.connection.timeout and http.socket.timeout) get replaced by some arbitrary defaults (600000 ms) I've yet to find anywhere.
Axis uses HttpClient(this.connectionManager), so it's the HttpClient(HttpConnectionManager httpConnectionManager) case, which contains the line "private HttpClientParams = null".
Since I'm more familiar with more traditional programming languages I'm trying to figure out where those timeout parameters are set to 10 minutes and how to set the defaults to values actually suited for this task.
In axis-1_4/src/org/apache/axis/transport/http/CommonsHTTPSender.java the parameters are set correctly by "initialize":
[07.05.07 15:36:09.202] (DEBUG) [DefaultHttpParams]: Set parameter http.connection.timeout = 20001
[07.05.07 15:36:09.203] (DEBUG) [DefaultHttpParams]: Set parameter http.socket.timeout = 20003
...but get overwritten during "invoke":
[07.05.07 15:36:09.454] (DEBUG) [DefaultHttpParams]: Set parameter http.socket.timeout = 600000
[07.05.07 15:36:09.455] (DEBUG) [DefaultHttpParams]: Set parameter http.connection.timeout = 600000
I've tried setting them within "invoke", but to no avail, so I looked deeper into "HttpClient.java" and was stumped by "private HttpClientParams = null".
Can anybody point me in the right direction?
Thanks in advance,
Jens Goerke
--
Jens Goerke, Unix-Systeme HA/SAN, mobilcom Communicationstechnik GmbH, Hollerstr. 126, 24782 Büdelsdorf
jens.goerke@freenet.ag, Tel: +49-(0)4331-69-5505 Fax: +49-(0)4331-69-5588
Geschäftsführung: Eckhard Spoerr, Stephan Brauer, Christoph Steffens
Sitz: Schleswig, Amtsgericht Flensburg HRB 0794 SL
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: [HttpClient.java] HttpParams
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2007-05-08 at 17:12 +0200, Jens Goerke wrote:
> Oleg,
>
> > HttpParams associated with HttpClient are expected to be initialized
> by
> > the constructor. Hence null assignment in the instance variable
> > declaration.
>
> The HttpParams are initialized, given to the HttpConnectionManager, but
> then get clobbered within HttpClient.
>
I do not think this observation is correct. Feel free to double-check,
tough.
> > As far as I know CommonsHTTPSender reads the default parameter values
> > from a configuration file
>
> Which configuration file would that be?
axis2.xml
> I haven't found any reference to
> the 600000 ms timeout anywhere in any source or configuration file.
>
> [code sample]
> Yes, that's basically how the HttpParams are set in our code.
>
> > The easiest solution to this problem would be to use the Axis2 config
> > file to initialize the HTTP sender
>
> I'm not sure that would help - Axis is using
> HttpClient(ConnectionManager),
> which re-sets the HttpParams to its own defaults instead of using them
> as
> they are.
>
> Perhaps I do need to modify HttpClient.java after all.
>
You are very welcome to do so. It is open-source after all
> Thanks anyway,
> Jens
>
Oleg
> ---------------------------------------------------------------------
> 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
Re: [HttpClient.java] HttpParams
Posted by Jens Goerke <Je...@mobilcom.de>.
Oleg,
> HttpParams associated with HttpClient are expected to be initialized
by
> the constructor. Hence null assignment in the instance variable
> declaration.
The HttpParams are initialized, given to the HttpConnectionManager, but
then get clobbered within HttpClient.
> As far as I know CommonsHTTPSender reads the default parameter values
> from a configuration file
Which configuration file would that be? I haven't found any reference to
the 600000 ms timeout anywhere in any source or configuration file.
[code sample]
Yes, that's basically how the HttpParams are set in our code.
> The easiest solution to this problem would be to use the Axis2 config
> file to initialize the HTTP sender
I'm not sure that would help - Axis is using
HttpClient(ConnectionManager),
which re-sets the HttpParams to its own defaults instead of using them
as
they are.
Perhaps I do need to modify HttpClient.java after all.
Thanks anyway,
Jens
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: [HttpClient.java] HttpParams
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2007-05-08 at 13:52 +0200, Jens Goerke wrote:
> Hi!
>
> When calling HttpClient via Axis the previously set HttpParams (http.connection.timeout and http.socket.timeout) get replaced by some arbitrary defaults (600000 ms) I've yet to find anywhere.
>
> Axis uses HttpClient(this.connectionManager), so it's the HttpClient(HttpConnectionManager httpConnectionManager) case, which contains the line "private HttpClientParams = null".
>
> Since I'm more familiar with more traditional programming languages I'm trying to figure out where those timeout parameters are set to 10 minutes and how to set the defaults to values actually suited for this task.
>
> In axis-1_4/src/org/apache/axis/transport/http/CommonsHTTPSender.java the parameters are set correctly by "initialize":
> [07.05.07 15:36:09.202] (DEBUG) [DefaultHttpParams]: Set parameter http.connection.timeout = 20001
> [07.05.07 15:36:09.203] (DEBUG) [DefaultHttpParams]: Set parameter http.socket.timeout = 20003
>
> ...but get overwritten during "invoke":
> [07.05.07 15:36:09.454] (DEBUG) [DefaultHttpParams]: Set parameter http.socket.timeout = 600000
> [07.05.07 15:36:09.455] (DEBUG) [DefaultHttpParams]: Set parameter http.connection.timeout = 600000
>
> I've tried setting them within "invoke", but to no avail, so I looked deeper into "HttpClient.java" and was stumped by "private HttpClientParams = null".
>
> Can anybody point me in the right direction?
>
> Thanks in advance,
> Jens Goerke
Jens,
HttpParams associated with HttpClient are expected to be initialized by
the constructor. Hence null assignment in the instance variable
declaration.
As far as I know CommonsHTTPSender reads the default parameter values
from a configuration file
=====================
// Get the timeout values from the configuration
try {
Parameter tempSoTimeoutParam = transportOut
.getParameter(HTTPConstants.SO_TIMEOUT);
Parameter tempConnTimeoutParam = transportOut
.getParameter(HTTPConstants.CONNECTION_TIMEOUT);
if (tempSoTimeoutParam != null) {
soTimeout = Integer.parseInt((String) tempSoTimeoutParam
.getValue());
}
if (tempConnTimeoutParam != null) {
connectionTimeout = Integer
.parseInt((String)
tempConnTimeoutParam.getValue());
}
} catch (NumberFormatException nfe) {
// If there's a problem log it and use the default values
log.error("Invalid timeout value format: not a number",
nfe);
}
=====================
The easiest solution to this problem would be to use the Axis2 config
file to initialize the HTTP sender
Hope this helps
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org