Hello Yuan-Fang,
>I'd like to know whether there's a way to instruct restlet to redirect to a
>particular URL?
yes, you can update the response with one of the Response#redirect* methods.
That asks the client to send another request.
But I wonder if this is really your question...
If I understand well, in case of unauthorized acces to resource A, you
want the user to hit a resource B (the login page), then to be
redirected to resource A after a successful operation on Resource C (a
POST on a "login" resource, I guess).
I think that the first request (to the login page) must contain all
required data (I mean the URL of resource A) via query parameter,
cookie, standard header ("Referer"?), specific header, entity, etc. i.e.
one of the supported mechanisms in order that the login operation (done
via the login page) is aware of the redirected URL and redirects or
transmits the message correctly to the resource A.
You must make the required data accessible in two requests: the request
to resource B, the request to resource C.
Best regards,
Thierry Boileau
> Hi list,
>
> In our webapp we use spring+restlet (2.0-M5). Spring is setup to provide
> role-based authentication for URLs. In some (restlet) resources, we have
> custom code for more fine-grained authorization. There's a scenario where
> Spring grants access but our custom code requires the user to login to access
> the resource.
>
> What we'd like to do is to have the webapp redirect back to the resource page
> after successful login. However, the webapp always redirects to the spring's
> default target URL. I'd like to know whether there's a way to instruct
> restlet to redirect to a particular URL.
>
> This is how we redirect the user to the login page in the resource:
>
> getResponse().redirectTemporary(getRequest().getRootRef().toString() +
> "/login");
>
> Thanks!
> Yuan-Fang
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2448644
>
>
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2448737