struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lupestro <ralphm...@comcast.net>
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
book/1/chapter/3:

>  1. enable the NamedVariablePatternMatcher via struts.xml 
>  2. Create the BookController in the root namespace.  GET /book/123 will 
> invoke BookController.show() 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
this?

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.

Ralph


--
View this message in context: http://struts.1045723.n5.nabble.com/Does-REST-plugin-support-complex-RESTful-URLs-tp5549042p5549581.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message