You gave me an excellent helpfull advice. I'm using Restlet version 1.2-M2
from maven repository located in http://maven.restlet.org. It's not possible to
use method getPattern() from Route class, but I found based on your advice that
I can use this kind of code:
Route route = iter.next();
System.out.println("\tResource: " +
route.getTemplate().getPattern().toString());
Probably in higher still developed version 2.0 (testing) of Restlet the Route
class is deprecated, but during using 1.2-M2 (stable) version there is not any
TemplateRoute class.
THANKS VERY MUCH!!! I appreciate your help, really thanks for your help, it's
good to see somebody is reading discussions here ;-)
> Hello Martin,
>
> I think you can use the Route#getPattern() method. As a side note, I
> suggest you to use the TemplateRoute class instead of Route which is
> deprecated.
>
> Regards,
> Thierry Boileau
>
>
> > Hello, I'm absolutely beginner, but it's very interesting for me to get in
> > touch more closely with Restlet. Here is code of my app which creates rest
> > router and defines "routes" (URI parts) for the resource "item" (Java
> > classes).
> >
> > @Override
> > public synchronized Restlet createRoot() {
> > // Create a router Restlet that defines routes.
> > Router router = new Router(getContext());
> > // Defines a route for the resource "list of items"
> > router.attach("/items", ItemsResource.class);
> > // Defines a route for the resource "item"
> > router.attach("/items/{itemName}", ItemResource.class);
> > router.attach("/itemx/{itemName}", ItemResource.class);
> >
> >
> > System.out.println(router.getRoutes().toString());<----------!!!!
> > System.out.println(router.getRoutes().isEmpty());<----------!!!!
> > System.out.println(router.getRoutes().size());<----------!!!!
> >
> > System.out.println("Resource List:");
> >
> > RouteList routeList = router.getRoutes();
> > for (Iterator<Route> iter = routeList.iterator();
> > iter.hasNext();) {
> > Route route = iter.next();
> > System.out.println("\tResource: " + route.toString() +
> > " " + route.getTemplate().toString() + " " +
> > route.getContext().toString());<----------!!!!
> > }
> > return router;
> > }
> >
> > Problem is: !!!I'm not able!!! to find human-readable list of URIs which I
> > used , that means I'd like to see something like:
> >
> > Resource List:
> > Resource: /items
> > Resource: /items/{itemName}
> > Resource: /itemx/{itemName}
> >
> > But I still see only object-readable format:
> > Resource List:
> > Resource: org.restlet.routing.ro...@624b035d
> > Resource: org.restlet.routing.ro...@2aca0115
> > Resource: org.restlet.routing.ro...@340d1fa5
> >
> > Is it possible to ask Rest running application for human-readable list of
> > URIs under which are hidden appropriate resources??
> > Please help, thanks very much.
> >
> > ------------------------------------------------------
> > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2448707
> >
> >
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2448752