struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Al Sutton <al.sut...@alsutton.com>
Subject Re: REST plugin URL syntax
Date Mon, 16 Jun 2008 20:11:36 GMT
It's true that it takes a bit of reading between the lines, but 
basically REST relies on unique identifiers for resources, which for 
HTTP is commonly taken to mean a URLs of the form;

http://server/resource_noun/id

(to confirm this have a spin through the google results showing various 
examples).

With servers with many apps on this is commonly expanded to;

http://server/app/resource_noun/id

In the strictest send the Mikes URLs should be;

http://www.mydomain.com/chapter/123_1

because we are uniquely identifying a chapter and to do this we need to 
include the book id, but for the sake of clarity (which was the reason I 
beleive he was using x/x_id/y/y_id notation I expanded the noun to show 
book and chapter.

Al.


Laurie Harper wrote:
> It may be the case that the REST plugin can't support this (I don't 
> know if that's true) but I don't see anything in the cited reference 
> that says such URLs are un-RESTful. And a Struts apps should certainly 
> be able to support them, even if it requires writing a little more 
> code (e.g. a custom action mapper?)
>
> L.
>
> Al Sutton wrote:
>> Mike,
>>
>> Rest URLs doesn't work that way, so the plugin is correct and your 
>> needs are not in sync with REST standards (see 
>> http://en.wikipedia.org/wiki/Representational_State_Transfer for a 
>> more details on REST).
>>
>> If you want to do something with multiple IDs my suggestion would be 
>> URLs along the lines of;
>>
>> http://www.mydomain.com/rest/bookAndChapter/123_1
>>
>> Al.
>>
>> Mike Watson wrote:
>>> Hi Folks,
>>>
>>> I'm trying to use the REST plugin to implement a service that serves
>>> resources using the following url syntax:
>>>
>>> http://www.mydomain.com/rest/book/123   (which works fine)
>>> http://www.mydomain.com/rest/book/123/chapter   (which throws a 500
>>> because my book controller doesn't have a chapter() method)
>>> http://www.mydomain.com/rest/book/123/chapter/1   (which returns 404)
>>>
>>> I'd expect the two chapter urls to access the ChapterController
>>> instead of the BookController.
>>>
>>> Being able to request resources 'within resources' like this is
>>> crucial to my application. Can anybody tell me how I can configure the
>>> rest plugin to behave like this, or point me at some documentation
>>> that does?
>>>
>>> Thanks in advance,
>>>
>>> Mike
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>   
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Mime
View raw message