Hello renfeng,
did you try to call the following methods on the request object?
- request.getResourceRef().getBaseRef()
- request.getHostRef()
- request.getRootRef()
Otherwise, you can get the servletContext by casting the context:
ServletContextAdapter c = (ServletContextAdapter)
,
Redirector.MODE_CLIENT_SEE_OTHER));
--
View this message in context:
http://n2.nabble.com/how-to-redirect-to-another-resource--tp1689188p1689188.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.
--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId
parameter.
Changes in SVN trunk. Thanks for the suggestions!
Best regards,
Jerome
-Message d'origine-
De : Rob Heittman [mailto:[EMAIL PROTECTED]
Envoyé : dimanche 16 décembre 2007 22:37
À : discuss@restlet.tigris.org
Objet : Re: How to redirect to a resource?
I left out a step
Hi all,
I have a problem redirecting to a resource in my app if the app is
mapped to non-root URL. The setup is as follows:
I have a restlet application deployed in Tomcat under the /app
context. The restlet ServerServlet is mapped to /api/*, so to root
restlet of my application is actually
Hi Pavel,
I'd start with the resource reference exposed by Request, and use the
methods of the Reference object to do what you want, e.g.
response.redirectTemporary(
new Reference(
request.getResourceRef().getParentRef().getParentRef(),
group/ + groupId
)
);
But Jerome and friends,
Thank Rob, but the constructor Reference(Reference, String) does not
seem to work, it actually produces a Reference instance that seem to
completely ignore the first argument.
More exactly, the following code:
final String baseHref = http://localhost:8080/app/api;;
final String path =
I left out a step in the first example I typed. You have to explicitly
getTargetRef() ... I did this in the second block of code but omitted it in
the first. So, that example, corrected is:
response.redirectTemporary(
new Reference(
request.getResourceRef ().getParentRef().getParentRef(),
7 matches
Mail list logo