users@jersey.java.net

Re: [Jersey] [PATCH] to allow the API of RESTful services to be rendered using hierarchial Implicit Views

From: James Strachan <james.strachan_at_gmail.com>
Date: Thu, 19 Feb 2009 15:42:31 +0000

2009/2/19 Paul Sandoz <Paul.Sandoz_at_sun.com>:
> Hi James,
>
> This looks really interesting! thanks for doing this.

No worries - it was fun! I was surprised how easy it was to reuse the
WadlResource in an implicit view with really minor changes to Jersey!


> I am going to take a close look at this tomorrow. My first thought is we
> should move the Jersey WadlResource class to the API and we document it in
> relation to views.

Yeah - it seems a very handy class and something I can imagine lots of
folks tinkering with to get better self-documenting RESTful services.

Incidentally I just attached a slightly modified patch; I found that
there's a small discrepency between WADL's idea of child resources and
JAX-RS path navigation. Namely that JAX-RS navigates a new path by
splitting on "/" so "foo/{bar}" would be 2 paths - whereas in WADL
documents "foo/{bar}" is often one path - so to work around this I've
introduced a simple PartialResource class which matches the "foo" part
so that when "{bar}" is navigated to it correctly finds the
"foo/{bar}" resource in WADL etc.

e.g. this URL now works in the Camel example...
http://localhost:8080/api/resources/endpoints/{id}/messages/{id}

as "messages/{id}" is a single child resource of {id} if you see what I mean.

-- 
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/