hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Berlin" <sber...@gmail.com>
Subject Re: [HttpClient] problem with removing HTTP request interceptor
Date Mon, 10 Mar 2008 13:20:45 GMT
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
<johannes.koch@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


Mime
View raw message