Hello,
I have a question about route and router.
I have the following router
final Router router = new Router(getContext());
router.attach("/users", UsersResource.class);
router.attach("/users/{id}", UserResource.class);
router.attach("/users/identification-keys",
IdentificationKeysResource.class);
return router;
If I go to http://localhost/users/identification-keys I got a 405 error
in return
If I declare the last line first, like this
final Router router = new Router(getContext());
router.attach("/users/identification-keys",
IdentificationKeysResource.class);
router.attach("/users", UsersResource.class);
router.attach("/users/{id}", UserResource.class);
return router;
then it works.
I tried to change behavior of router using
router.setDefaultMatchingMode(Template.MODE_EQUALS);
but nothing seems to changed.
Is it possibly something not correct in my resource class ?
Right now, it's ok for me to declare in the second way my resource, but
I think it should work also in the first way,
as shown by the tutorial
http://www.restlet.org/documentation/2.0/tutorial#part12
Another question, should I attach route using a trailing slash in URI,
or not, or should I declare two routes ?
router.attach("/users", UsersResource.class);
router.attach("/users/", UsersResource.class);
Regards,
Laurent.
P.S: using restlet 2.0 M4
--
Laurent Rustuel,
Alten contractor for Alcatel-Lucent, Brest
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2382092