You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by François-Xavier Bonnet <fr...@centraliens.net> on 2013/02/11 13:45:22 UTC
HttpParams in HttpClient 4.3-alpha1
Hello,
I am currently migrating a project from 4.2.3 to 4.3-alpha1
For cookies I am using BrowserCompatSpec this way:
httpRequest.getParams().setParameter(ClientPNames.COOKIE_POLICY,
CookiePolicy.BROWSER_COMPATIBILITY);
But now it looks like this parameter is just ignored.
I know HttpParams are deprecated and I will fix my code but isn't 4.3
version supposed to be compatible with 4.2.3 ?
Regards,
Francois-Xavier Bonnet
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: HttpParams in HttpClient 4.3-alpha1
Posted by François-Xavier Bonnet <fr...@centraliens.net>.
It works. Thanks a lot.
I will create a JIRA to keep track of this bug and commit your fix.
On 11/02/2013 17:18, olegk@apache.org wrote:
> On Mon, 2013-02-11 at 16:54 +0100, François-Xavier Bonnet wrote:
>> My test is:
>>
>> HttpClient httpClient = new DefaultHttpClient();
>> HttpUriRequest request = new HttpGet(
>> "http://localhost:8080/");
>> request.getParams().setParameter(ClientPNames.COOKIE_POLICY,
>> CookiePolicy.BROWSER_COMPATIBILITY);
>> HttpResponse response = httpClient.execute(request);
>>
>> In HttpClient 4.2.3 BrowserCompatSpec is used but in 4.3 it is BestMatchSpec
>>
>> HttpClientParamConfig is used only if I build my HttpClient the new way
>> (using HttpClientBuilder).
>>
>> Do we consider it as a bug?
> Certainly a bug. Try this patch out. If it fixes the problem for you
> feel free to commit it to SVN trunk.
>
> Oleg
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: HttpParams in HttpClient 4.3-alpha1
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2013-02-11 at 16:54 +0100, François-Xavier Bonnet wrote:
> My test is:
>
> HttpClient httpClient = new DefaultHttpClient();
> HttpUriRequest request = new HttpGet(
> "http://localhost:8080/");
> request.getParams().setParameter(ClientPNames.COOKIE_POLICY,
> CookiePolicy.BROWSER_COMPATIBILITY);
> HttpResponse response = httpClient.execute(request);
>
> In HttpClient 4.2.3 BrowserCompatSpec is used but in 4.3 it is BestMatchSpec
>
> HttpClientParamConfig is used only if I build my HttpClient the new way
> (using HttpClientBuilder).
>
> Do we consider it as a bug?
Certainly a bug. Try this patch out. If it fixes the problem for you
feel free to commit it to SVN trunk.
Oleg
Re: HttpParams in HttpClient 4.3-alpha1
Posted by François-Xavier Bonnet <fr...@centraliens.net>.
My test is:
HttpClient httpClient = new DefaultHttpClient();
HttpUriRequest request = new HttpGet(
"http://localhost:8080/");
request.getParams().setParameter(ClientPNames.COOKIE_POLICY,
CookiePolicy.BROWSER_COMPATIBILITY);
HttpResponse response = httpClient.execute(request);
In HttpClient 4.2.3 BrowserCompatSpec is used but in 4.3 it is BestMatchSpec
HttpClientParamConfig is used only if I build my HttpClient the new way
(using HttpClientBuilder).
Do we consider it as a bug?
On 11/02/2013 14:12, olegk@apache.org wrote:
> On Mon, 2013-02-11 at 13:45 +0100, François-Xavier Bonnet wrote:
>> Hello,
>>
>> I am currently migrating a project from 4.2.3 to 4.3-alpha1
>>
>> For cookies I am using BrowserCompatSpec this way:
>> httpRequest.getParams().setParameter(ClientPNames.COOKIE_POLICY,
>> CookiePolicy.BROWSER_COMPATIBILITY);
>>
>> But now it looks like this parameter is just ignored.
>>
>> I know HttpParams are deprecated and I will fix my code but isn't 4.3
>> version supposed to be compatible with 4.2.3 ?
>>
>> Regards,
>> Francois-Xavier Bonnet
>>
> There is an attribute in RequestConfig that represents a name of cookie
> policy to be used during request execution.
>
> http://hc.apache.org/httpcomponents-client-dev/httpclient/apidocs/org/apache/http/client/config/RequestConfig.html#getCookieSpec%28%29
>
> If it has no effect, it is a bug.
>
> There is also a utility class that generates RequestConfig from
> HttpParam used internally by HttpClient to provide backward
> compatibility for deprecated functionality. It _should_ pick up cookie
> spec from HttpParam.
>
> http://hc.apache.org/httpcomponents-client-dev/httpclient/apidocs/org/apache/http/client/params/HttpClientParamConfig.html#getRequestConfig%28org.apache.http.params.HttpParams%29
>
> Oleg
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: HttpParams in HttpClient 4.3-alpha1
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2013-02-11 at 13:45 +0100, François-Xavier Bonnet wrote:
> Hello,
>
> I am currently migrating a project from 4.2.3 to 4.3-alpha1
>
> For cookies I am using BrowserCompatSpec this way:
> httpRequest.getParams().setParameter(ClientPNames.COOKIE_POLICY,
> CookiePolicy.BROWSER_COMPATIBILITY);
>
> But now it looks like this parameter is just ignored.
>
> I know HttpParams are deprecated and I will fix my code but isn't 4.3
> version supposed to be compatible with 4.2.3 ?
>
> Regards,
> Francois-Xavier Bonnet
>
There is an attribute in RequestConfig that represents a name of cookie
policy to be used during request execution.
http://hc.apache.org/httpcomponents-client-dev/httpclient/apidocs/org/apache/http/client/config/RequestConfig.html#getCookieSpec%28%29
If it has no effect, it is a bug.
There is also a utility class that generates RequestConfig from
HttpParam used internally by HttpClient to provide backward
compatibility for deprecated functionality. It _should_ pick up cookie
spec from HttpParam.
http://hc.apache.org/httpcomponents-client-dev/httpclient/apidocs/org/apache/http/client/params/HttpClientParamConfig.html#getRequestConfig%28org.apache.http.params.HttpParams%29
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org