Hi all,
I've been going through the First Resource tutorial for Restlet 1.1, and would
like to find out how to define a "root" URL for the various routes (to
resources) defined in my Restlet application. I am deploying the Restlet
application as a stand-alone Java application and not in a Servlet container.
To explain further:
If I have the createRoot() method defined in my Application subclass as follows:
public Restlet createRoot() {
Router router = new Router(getContext());
router.attach("/items", ItemsResource.class);
router.attach("/items/{itemName}", ItemResource.class);
return router;
}
How do I define a root URL so that all resource routes are interpreted relative
to that URL?
For example if I want the root URL to be /myapp, then I want to retrieve the
resources above as follows:
http://localhost:8082/myapp/items
http://localhost:8082/myapp/items/1234
I realise I can just prepend /myapp/ to the resource paths in the
router.attach() calls above, but if I have lots of path to resource mappings
then editing the whole lot if I want to change the "root" URL would be quite
tedious.
I've trawled through the tutorials and the JavaDocs so maybe I'm missing
something really obvious.
Thanks in advance
Glen
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2592602