Ah, very good, that protected method was confusing me since it made it
look like I was supposed to extend.

As a Filter, is it intended to hold a mapping of all validations for
all routes or does it wrap each individual validated route? I'm not
sure how to go from the basic

router.attach("pathA", MyServerResourceA.class);
router.attach("pathB", MyServerResourceB.class);
router.attach("pathC", MyServerResourceC.class);

to something that wraps MyServerResource in a Validator which is
different for each resource. Perhaps some quick pseudo code?

Additionally, what about a structure like:

router.attach("pathA/{ida}", MyServerResourceA.class);
router.attach("pathA/{ida}/pathB/{idb}", MyServerResourceB.class);
router.attach("pathA/{ida}/pathB/{idb}/pathC/{idc}", MyServerResourceC.class);

Is there a way to reuse the validator of {ida} in the two following routes?



On Mon, Nov 23, 2009 at 9:23 AM, Jerome Louvel
<[email protected]> wrote:
> Hi Ben,
>
> Not yet, but it is very straightforward. Actually this feature existed in
> Restlet 1.1 but was hidden in the Route class. Looking at the API again, I
> noticed an issue: the validate() method should be public instead of
> protected. This is fixed in SVN trunk.
>
> You just need to call this method for each request attribute that you want
> to check for presence and/or for format. You can provide its format as a
> Java Regex.
>
> Best regards,
> Jerome Louvel
> --
> Restlet ~ Founder and Lead developer ~ http://www.restlet.org
> Noelios Technologies ~ Co-founderĀ ~ http://www.noelios.com
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2423668

Reply via email to