Fabio,
I had asked this question as well. The answer is to do this: final Router router = new Router(getContext()) { @Override public Restlet getNext(final Request request, final Response response) { final Restlet result = super.getNext(request, response); if (result instanceof Route) { final Route route = (Route) result; final String uriPattern = route.getTemplate().getPattern(); s_logger.log(Level.INFO,"User requested route: " + uriPattern); request.getAttributes().put(TEMPLATE_URI_PATTERN_ATTRIBUTE, uriPattern); } return result; } }; You can then get the value with request.getAttribute Cliff Binstock Coyote Reporting > -----Original Message----- > From: Fabio Mancinelli [mailto:fabio.mancine...@gmail.com] > Sent: Wednesday, January 07, 2009 8:07 AM > To: discuss@restlet.tigris.org > Subject: Retrieving the UriTemplate associated to a Resource class > > Dear all, > > I have already implemented this by building additional infrastructure, but > I was wondering if, from inside a Resource, there is a way for retrieving > which UriTemplate is associated to a given Resource class. > > To be more explicit: > > In application: > router.attach("/myResource", MyResource.class) > > In MyResource I would like to have something like: > getUriTemplateFor(MyResource.class) -> "/myResource" > > I digged a bit into the API but I haven't find anything like this. > > Thanks, > Fabio > > ------------------------------------------------------ > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=101 > 0096 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1022243