struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lupestro <>
Subject Re: Does REST plugin support complex RESTful URLs?
Date Fri, 09 Mar 2012 03:47:30 GMT
> I checked the list archives for the past year and looked at the examples 
> on the web but didn't see anything that looked like it had the potential 
> to address this. 

OK - I dug further (using nabble this time) and found the discussion from
July 2008 where Jeromy Evans sketched an approach for URIs of the form

>  1. enable the NamedVariablePatternMatcher via struts.xml 
>  2. Create the BookController in the root namespace.  GET /book/123 will 
> invoke with id=123 
> 3. Create the ChapterController in the namespace containing the book id 
> variable (/book/{bookid}). GET /book/123/chapter will invoke 
> ChapterContoller.index() with bookId=123. 
> [...]
> @Namespace("/") 
> public class BookController implements ModelDriven<Book> {  } 
> @Namespace("/book/{bookId}") 
> public class ChapterController implements ModelDriven<Chapter> {  } 

Unfortunately, his sample has gone missing over the years, but I can follow
the breadcrumbs from the snippet above.

That discussion also had a lively side-discussion on what is or is not
RESTful. I will readily admit that the multi-selection of resources implied
by the following isn't RESTful.

- /hair/bears/furbolg/12-14+16-18/coat-color 

However, the following unambiguous field identification is RESTful:

- /hair/bears/furbolg/12/coat-color is, 

so that is the problem that I will address and leave the multi-select case
behind. However, Jeromy's approach has me creating a class for each field I
wish to support, which seems awkward, and then I'm not sure I can do PUTs
without a follow-on ID after the field name. Is there a good way around

Is Jeromy's approach still the plan of record or has something been
introduced since then that is more akin to what Rails, Spring MVC, and
ASP.NET MVC do? I know it would be easy with that sort of annotation.


View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message