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 Stevo Slavić <ss...@gmail.com> on 2011/01/18 21:23:23 UTC

Changing connection manager params

Hello httpclient users,

Can someone please just validate if following is true or not. It seems
to me that it was possible in 3.x to change connection manager
parameters even after it's construction. It doesn't seem possible now
in 4.0.x, without instantiating new connection manager.

Regards,
Stevo.

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


Re: Changing connection manager params

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2011-01-19 at 09:57 +0100, Stevo Slavić wrote:
> Besides 4.1-beta2-snapshot [1], I don't see 4.1 (GA) at maven central
> [2]. Switched to that snapshot.
> 

The release vote is ongoing. I expect it to be closed tomorrow.

> Found means to change configuration - most I couldn't initially find
> moved from http connection manager (in 3.1) to httpclient (in 4.0),
> and then in 4.1 some *PNames values got deprecated and configuration
> moved to implementations like ThreadSafeClientConnManager so can not
> code to interfaces but to implementation on some places.
> 

Those methods are not part of the connection manager interface because
they are implementation specific. Not all connection managers maintain a
pool of connections.


> Some API changes between 3.1 and 4.x I'm not sure if they are equivalent:
> 
> - HttpRequestBase seems to be new HttpMethodBase, but couldn't find
> replacement for setFollowRedirects - maybe setting
> ClientPNames.MAX_REDIRECTS parameter to 0 is equivavalent

See ClientPNames#HANDLE_REDIRECTS

> - old HttpMethodBase.getResponseCharSet/getRequestCharSet it seems to
> be replaced by EntityUtils.getContentCharSet(response.getEntity())

Correct.

> - not sure what replaces PostMethod.addParameter(paramName, paramValue)

UrlEncodedFormEntity.

> - getStatusCode and getStatusText present in HttpMethodBase seem to be
> removed in favour of just keeping getStatusLine in HttpResponse
> 

Correct.

Oleg


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


Re: Changing connection manager params

Posted by Stevo Slavić <ss...@gmail.com>.
Besides 4.1-beta2-snapshot [1], I don't see 4.1 (GA) at maven central
[2]. Switched to that snapshot.

Found means to change configuration - most I couldn't initially find
moved from http connection manager (in 3.1) to httpclient (in 4.0),
and then in 4.1 some *PNames values got deprecated and configuration
moved to implementations like ThreadSafeClientConnManager so can not
code to interfaces but to implementation on some places.

Some API changes between 3.1 and 4.x I'm not sure if they are equivalent:

- HttpRequestBase seems to be new HttpMethodBase, but couldn't find
replacement for setFollowRedirects - maybe setting
ClientPNames.MAX_REDIRECTS parameter to 0 is equivavalent
- old HttpMethodBase.getResponseCharSet/getRequestCharSet it seems to
be replaced by EntityUtils.getContentCharSet(response.getEntity())
- not sure what replaces PostMethod.addParameter(paramName, paramValue)
- getStatusCode and getStatusText present in HttpMethodBase seem to be
removed in favour of just keeping getStatusLine in HttpResponse


Regards,
Stevo.

[1] https://repository.apache.org/content/repositories/snapshots/org/apache/httpcomponents/httpclient/4.1-beta2-SNAPSHOT/
[2] http://repo2.maven.org/maven2/org/apache/httpcomponents/httpclient/

On Tue, Jan 18, 2011 at 9:57 PM, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Tue, 2011-01-18 at 21:23 +0100, Stevo Slavić wrote:
>> Hello httpclient users,
>>
>> Can someone please just validate if following is true or not. It seems
>> to me that it was possible in 3.x to change connection manager
>> parameters even after it's construction. It doesn't seem possible now
>> in 4.0.x, without instantiating new connection manager.
>>
>
> It should certainly be possible with 4.0.x, but I would recommend
> upgrading to 4.1 which has a better API for connection pool management.
>
> 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: Changing connection manager params

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2011-01-18 at 21:23 +0100, Stevo Slavić wrote:
> Hello httpclient users,
> 
> Can someone please just validate if following is true or not. It seems
> to me that it was possible in 3.x to change connection manager
> parameters even after it's construction. It doesn't seem possible now
> in 4.0.x, without instantiating new connection manager.
> 

It should certainly be possible with 4.0.x, but I would recommend
upgrading to 4.1 which has a better API for connection pool management.

Oleg 



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