users@jersey.java.net

Re: [Jersey] how to use ApacheHttpClient

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Tue, 15 Jun 2010 13:10:46 +0200

Hello,

On 6/15/10 12:28 PM, reno.rkcrew_at_free.fr wrote:
>
> hello all,
>
> I would like to know how to use the ApacheHttpClientXXX classes. I read the
> package summary [1] but i don't know how to use it with in a jersey webapp :-(
>
  you have to create client instance this way:

Client c = ApacheHttpClient.create();

and you need to declare dependency for that:

<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-apache-client</artifactId>
<version>${project.version}</version>
</dependency>

Hope it helps,
Pavel

> In the user guide [2], there is this paragraph:
> "The support for HTTP authentication and cookies is much better with the Apache
> HTTP client than with HttpURLConnection. See the Java documentation for the
> package com.sun.jersey.client.apache, ApacheHttpClientState and
> ApacheHttpClientConfig for more details. "
> it does not help me a lot :-(
>
> My goal is to add a filter for all the requests (that comes from an apache httpd
> server): if the cookie does not exist, we create it in the filter.
>
> Is anybody has ever done it?
>
> Regards
>
> S.
>
> [1] :
> https://jersey.dev.java.net/nonav/apidocs/latest/contribs/jersey-apache-client/com/sun/jersey/client/apache/package-summary.html
> [2] :
> https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html#d4e687
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>