Hello Alex,

as a simpler way to provide such service, we think of a filter class managed at the level of the application or shared between several applications inside a component. Issue #288 [1] has been entered on this subject. You can already developp your own filter according to your own choices. That will allow you to delegate this kind of service outside your application code. If you are looking for a sample implementation and integration of a Filter, you can have a look to the TunnelFilter, or Guard classes.

Another issue [2] has been submitted about the cookies. It is planned to be developped for the next 1.1 beta release.

Best regards,
Thierry Boileau
[1] http://restlet.tigris.org/issues/show_bug.cgi?id=288
[2] http://restlet.tigris.org/issues/show_bug.cgi?id=42

I'm working on an application where all the requests to the
server much be authenticated.  I'd like to use the
Client.get()/etc. methods but to associated the ChallengeResponse
instance with the request, I need to use the Client.handle
method.

I've successfully done this another way by doing:


     Client client = new Client(new
Context(),config.getServerLocation().getSchemeProtocol()) {
        public void handle(Request request,Response response) {
           request.setChallengeResponse(new
ChallengeResponse(ChallengeScheme.HTTP_BASIC,"user","pass"));
           super.handle(request,response);
        }
     };

This way I can now call client.get("http://www.somewhere.com";) and get
a result without a 401 response.

Now, is there a better way?

The above seems a bit awkward.

I could image constructing a Client instance with the ChallengeResponse
instance or subclassing Client to create AuthenticatedClient.  Similarly,
I could see the need to track and send session information (e.g. cookies).

Are there helper classes for doing this as a client?

--Alex Milowski

Reply via email to