Hi Matt,
I am not familiar with FreeMarker (although I am looking into it), but I will
hazard to guess that it's not relevant to your question.
I think there is a simple way to design your application and minimize the
number of routes. Basically, you only need the first 2 routes you mentioned:
router.attach("/users", UsersResource.class);
router.attach("/user/{id}", UserResource.class);
To add users and edit existing ones, you do not even need to create another
resource or route. Instead, if you ensure your UsersResource and UserResource
classes extend the ServerResource class that comes with Restlets, you can
provide the add/edit functionality through this class by mapping it to the
different HTTP methods.
For adding a user, you would use either "POST" whatever URL maps to the
UsersResource (e.g. "/users") or "PUT" to whatever URL maps to the UserResource
(e.g. "/user/{id}"). Meanwhile, to edit a user, you can "PUT" to the
UserResource.
In Restlets 2.0, I think there are 2 ways to map a request to a method on your
Resource class.
1) Override the put(...), post(...) and other HTTP methods as needed.
2) Write a method and annotate it with a Java annotation like @Put("xml") (or
something like that...)
I read in the documentation that the annotations are not fully
supported/implemented yet, and I'm new to Restlets myself, so I'm sticking to
method #1 right now.
Hope that helps,
T
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2362489