users@jersey.java.net

Re: [Jersey] client authorization?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 10 Jul 2009 10:51:09 +0200

On Jul 10, 2009, at 10:30 AM, Martin Probst wrote:

> It works for me like this:
>
> resource.header(HttpHeaders.AUTHORIZATION, "Basic "
> + new String(Base64.encode("user:password"),
> Charset.forName("ASCII"))).get(...);
>
> Note that the header call returns a new object that you have to use,
> it doesn't seem to modify the existing one.
>
> There is also HTTPBasicAuthFilter but that had a bug that was only
> recently fixed on trunk.
>

Right.

Jersey also has support for the Apache HTTP client as the underlying
implementation used by the client API.

https://jersey.dev.java.net/nonav/apidocs/1.1.0-ea/contribs/jersey-apache-client/index.html
https://jersey.dev.java.net/nonav/apidocs/1.1.0-ea/contribs/jersey-apache-client/com/sun/jersey/client/apache/package-summary.html

Paul.