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 wv...@nikhef.nl on 2010/04/26 14:44:37 UTC

Default parameters (user-agent)

Hi,

I'm using the httpclient 4.0.1 library in an application and I've been 
looking for a way to set default parameters, but haven't found it in the 
4.x API.
I could set the user-agent after each creation of HttpClient, but then 
third party libraries I use (oauth-signpost) that use httpclient don't 
have the user-agent set.
Is there a way to set default parameters?

Kind regards,
- Willem van Engen

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


Re: Default parameters (user-agent)

Posted by wv...@nikhef.nl.
On 04/27/2010 11:52 PM, Oleg Kalnichevski wrote:
> On Tue, 2010-04-27 at 22:38 +0200, wvengen+list-httpclient@nikhef.nl
> wrote:
>> Hi Oleg,
>>
>> Thanks for your explanation. Just curious to know if this was a design
>> decision, or if it might change in the future.
>>
>
> It was a conscious design decision which is unlikely to change. Absence
> of static / global code helps ensure HttpClient can work correctly in
> managed environments such as JEE containers with a complex class loader
> hierarchy.

That makes sense, thanks. That means that libraries using httpclient 
should generally provide an api to set httpclient parameters.

Kind regards,
- Willem

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


Re: Default parameters (user-agent)

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2010-04-27 at 22:38 +0200, wvengen+list-httpclient@nikhef.nl
wrote:
> Hi Oleg,
> 
> Thanks for your explanation. Just curious to know if this was a design 
> decision, or if it might change in the future.
> 

It was a conscious design decision which is unlikely to change. Absence
of static / global code helps ensure HttpClient can work correctly in
managed environments such as JEE containers with a complex class loader
hierarchy.

Oleg   


> Regards,
> - Willem
> 
> On 04/26/2010 09:55 PM, Oleg Kalnichevski wrote:
> > Willem,
> >
> > HttpClient 4 does not provide a means of setting global parameters. You
> > can provide a custom HttpClient implementation that pre-populates
> > certain default parameters upon instantiation and use this class across
> > your application. Those parameters, however, will not apply to 3rd party
> > libraries if they create HttpClient instances internally.
> >
> > Oleg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



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


Re: Default parameters (user-agent)

Posted by wv...@nikhef.nl.
Hi Oleg,

Thanks for your explanation. Just curious to know if this was a design 
decision, or if it might change in the future.

Regards,
- Willem

On 04/26/2010 09:55 PM, Oleg Kalnichevski wrote:
> Willem,
>
> HttpClient 4 does not provide a means of setting global parameters. You
> can provide a custom HttpClient implementation that pre-populates
> certain default parameters upon instantiation and use this class across
> your application. Those parameters, however, will not apply to 3rd party
> libraries if they create HttpClient instances internally.
>
> Oleg

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


Re: Default parameters (user-agent)

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2010-04-26 at 14:44 +0200, wvengen+list-httpclient@nikhef.nl
wrote:
> Hi,
> 
> I'm using the httpclient 4.0.1 library in an application and I've been 
> looking for a way to set default parameters, but haven't found it in the 
> 4.x API.
> I could set the user-agent after each creation of HttpClient, but then 
> third party libraries I use (oauth-signpost) that use httpclient don't 
> have the user-agent set.
> Is there a way to set default parameters?
> 
> Kind regards,
> - Willem van Engen
> 

Willem,

HttpClient 4 does not provide a means of setting global parameters. You
can provide a custom HttpClient implementation that pre-populates
certain default parameters upon instantiation and use this class across
your application. Those parameters, however, will not apply to 3rd party
libraries if they create HttpClient instances internally.

Oleg


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