You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Johannes Koch <jo...@fit.fraunhofer.de> on 2008/03/10 13:49:06 UTC
[HttpClient] problem with removing HTTP request interceptor
Hi,
I try to remove the HTTP request interceptor RequestAddCookies from the
HTTP client.
DefaultHttpClient dhc = new DefaultHttpClient();
dhc.removeRequestInterceptorByClass(RequestAddCookies.class);
Compiling with Java 1.5 resulted in the following error:
The method
removeRequestInterceptorByClass(Class<HttpRequestInterceptor>) in the
type AbstractHttpClient is not applicable for the argument
(Class<RequestAddCookies>)
However, if I use the following code,
dhc.removeRequestInterceptorByClass(
(Class<HttpRequestInterceptor>) new RequestAddCookies().getClass());
I only get a warning. I'm not an expert in Java 1.5 generics; but is
there a way to remove the RequestAddCookies interceptor without first
creating a new instance of RequestAddCookies?
--
Johannes Koch
BIKA Web Compliance Center - Fraunhofer FIT
Schloss Birlinghoven, D-53757 Sankt Augustin, Germany
Phone: +49-2241-142628 Fax: +49-2241-142065
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [HttpClient] problem with removing HTTP request interceptor
Posted by Johannes Koch <jo...@fit.fraunhofer.de>.
Sam Berlin schrieb:
> That's a bug with the method signature. It should be defined as:
>
> public void removeRequestInterceptorByClass(Class<? extends
> HttpRequestInterceptor> clazz);
Thanks, Sam. Issue reported (HTTPCLIENT-758) and patch provided.
--
Johannes Koch
BIKA Web Compliance Center - Fraunhofer FIT
Schloss Birlinghoven, D-53757 Sankt Augustin, Germany
Phone: +49-2241-142628 Fax: +49-2241-142065
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [HttpClient] problem with removing HTTP request interceptor
Posted by Sam Berlin <sb...@gmail.com>.
That's a bug with the method signature. It should be defined as:
public void removeRequestInterceptorByClass(Class<? extends
HttpRequestInterceptor> clazz);
Sam
On Mon, Mar 10, 2008 at 8:49 AM, Johannes Koch
<jo...@fit.fraunhofer.de> wrote:
> Hi,
>
> I try to remove the HTTP request interceptor RequestAddCookies from the
> HTTP client.
>
> DefaultHttpClient dhc = new DefaultHttpClient();
> dhc.removeRequestInterceptorByClass(RequestAddCookies.class);
>
> Compiling with Java 1.5 resulted in the following error:
>
> The method
> removeRequestInterceptorByClass(Class<HttpRequestInterceptor>) in the
> type AbstractHttpClient is not applicable for the argument
> (Class<RequestAddCookies>)
>
> However, if I use the following code,
>
> dhc.removeRequestInterceptorByClass(
> (Class<HttpRequestInterceptor>) new RequestAddCookies().getClass());
>
> I only get a warning. I'm not an expert in Java 1.5 generics; but is
> there a way to remove the RequestAddCookies interceptor without first
> creating a new instance of RequestAddCookies?
>
> --
> Johannes Koch
> BIKA Web Compliance Center - Fraunhofer FIT
> Schloss Birlinghoven, D-53757 Sankt Augustin, Germany
> Phone: +49-2241-142628 Fax: +49-2241-142065
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org