I am building a large application with Restlet and I am very pleased so far with it.
I see that there is a request.getRootRef() method that I can use to get "http://localhost/myapp", but I want a way to get this RootRef after the Application is started but BEFORE any requests are routed to it. I was looking for something like application.getRootRef() but there is no such thing. The reason I want this is that my application needs a static top-level menu containing relative references to various locations in my Application, such as http://localhost/myapp/help and http://localhost/myapp/admin . I want to build this top-level menu at Application setup time and reuse it on all my pages throughout the life of the application, and not have to recompute these references upon each request. The problem with just using a uri like '/help' or '/admin' is that the browser resolves this to http://localhost/help or http://localhost/admin, leaving out the 'myapp' part of the URL. So why don't I just use '/myapp/help' and '/myapp/admin'? Well, I have defined constants HELP_URI = "/help" and ADMIN_URI = '/admin" for when I attach these resources to the router: router.attach(HELP_URI, HelpResource.class); router.attach(ADMIN_URI, AdminResource.class); This is executing in a Tomcat servlet environment with other servlets, and it has a context of 'myapp'. So by the time the routing gets to my router, the 'myapp' part has been stripped off and I'm left with just '/help'. I want to reuse these same constants when building the links in the menu items. I don't really like the idea of having two constants, one for building links ('/myapp/help') and one for attaching to the router ('/help'). I'd like to just use one constant ('/help') everywhere. But I can't seem to find a way to retrieve root reference that contains "myapp" until a request is processed, at which point I can get it by calling request.getRootRef(). But by then it is too late, I need it earlier so that I can wire everything up. So is there a nice way to get the rootRef just from the application at startup, before a request comes in? -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/How-to-obtain-rootRef-from-the-Application-tp5197074p5197074.html Sent from the Restlet Discuss mailing list archive at Nabble.com. ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2623541

