Hi,
I use Restlet in a servlet container, using the ServerServlet.
In the web.xml I have added the "org.restlet.component" param and set my
specific Component class.
When it comes to the applications for this component, I have to be able to
dynamically add and
remove applications.
But once the ServerServlet has been initialized (when the first request has
reached the servlet), adding
applications to the component's default host has no effect (the applications
can't be reached).
The reason (as far as I see) is in the ServerServlet.createServer() method:
When creating a new Server, the routes of the component's hosts are modified
and an offsetPath is added to the template patterns:
------
for (TemplateRoute route : component.getDefaultHost().getRoutes()) {
log("[Restlet] Attaching restlet: "
+ route.getNext() + " to URI: "
+ offsetPath
+ route.getTemplate().getPattern());
route.getTemplate().setPattern(
offsetPath + route.getTemplate().getPattern());
}
------
As a workaround I can add this path myself when subsequently adding new
applications to the component's host(s).
However, I wonder if the possibility to dynamically change the component's
applications might not be a useful feature in general.
Maybe the offsetPath could be stored in the component's host objects and used
when applications are added later.
Cheers,
Carsten
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2430478