Hello,
I'd like to model resources using Restlet in a similar way as Section 12
of the tutorial ("Reaching target Resources"). As a simple example, I'd
like to map URIs like "/users/{user}/birthday" to read the full name of
a user from a database (or hash-table).
As far as I understand the tutorial, I can create a Resource class (for
example BirthdayResource) that reads the username from the attribute in
the constructor and reads the birthday from the database. Then, it can
attach it to the router using something like this:
router.attach("/users/{user}/birthday", BirthdayResource.class);
The problem is that some username values might not be in this database,
in which case I'd like to return a "NOT FOUND" response.
Where is the right place to look whether-or-not the resource actually
exists? Shouldn't this be done before the Resource instance is created?
Where does this fit in the router/attach model?
Best wishes,
Bruno.