users@jersey.java.net

Re: [Jersey] looking for a sample with basic authentication

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Fri, 15 Jan 2010 10:56:56 +0100

Hi Felipe,

you can use something like this:

        // client basic auth demonstration
       c.addFilter(new HTTPBasicAuthFilter("user", "password"));

        System.out.println("Client: GET " + Server.BASE_URI);

        WebResource r = c.resource(Server.BASE_URI);

        String page = (String) r.path("/").get(String.class);


(and FYI, this is taken from https-clientserver-grizzly test).

Pavel

Felipe Gaścho wrote:
> I am looking for a jersey-client using basic authentication ...
>
> a set of CURL examples on how to send an entity with POST and basic
> authentication also helps.....................
>
>