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 mapped to
http://localhost:8080/app/api.

The restlets and resources are mapped as follows:

   /item/{item} - ItemResource
   /group/{group} - GroupResource (group is actually a collection of items)
   /item{item}/group - ItemInGroupRedirectingRestlet

As the names may suggest, I want the ItemInGroupRedirectingRestlet to
redirect to the URI of a group where the item {item} belongs to.

However, if I call

   response.redirectTemporary("/group/" + groupId);

it redirects to http://localhost:8080/group/groupId while I want it to
redirect to http://localhost:8080/app/api/group/groupId (as I have
written, http://localhost:8080/app/api is the root URL of my REST
application).

Can you please someone tell me what's the most appropriate way get it
redirected to the proper URL? Do I have to construct the target URL
manually by digging the necessary information from some Context
object, or is there a more elegant way?

thanks,

Pavel

Reply via email to