Hi Thierry,

thanks for your reply. I tried fiddling with what you suggested, but I
guess I am not doing it right, because I still can't get that to work.
Instead, I now use a custom Redirector.

If anyone is interested: What I did is subclass Redirector, override
handle() and simply add the ChallengeResponse to the request
parameter. I guess this will break with anything but basic
authentication, but it works for me at the moment.

Best regards,
Stefan

On Sat, May 8, 2010 at 8:18 PM, Thierry Boileau
<[email protected]> wrote:
> I think you can override the Application#createOutboundRoot method in order 
> to provide for example your own Filter that updates the Request (according to 
> the request's URI) with the right ChallengeResponse, and sets its "next" 
> property with the context client dispatcher:
>  getContext().getClientDispatcher()
>
> Take care of setting correctly the filter's context with the one of the 
> application.

I subclassed o.r.r.Filter as MyFilter with the following constructor:

public MyFilter(Context context) {
                this.setContext(context);
        }

and the following doHandle() method:

        @Override
        protected int doHandle(Request request, Response response) {
                // challengeResponse is a class variable that has been setup 
with
the required credentials:
                request.setChallengeResponse(challengeResponse);
                // As suggest in Thierry's email:
                this.setNext(this.getContext().getClientDispatcher());
                return super.doHandle(request, response);
        }

In my Application#createInboundRoot() I then create an instance of
MyFilter in addition to the Redirector that I use to redirect
client-calls to my other server:

MyFilter filter = new MyFilter(getContext());
Redirector redirector = new Redirector(getContext(),
                                REMOTE_RESOURCE_STRING,
                                Redirector.MODE_SERVER_OUTBOUND);

and attach both to the same path:



>
> Best regards,
> Thierry Boileau
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2605718
>



-- 
Stefan Ukena
Röhrigstraße 1
22763 Hamburg

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2607661

Reply via email to