struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Watson" <michael.f.wat...@gmail.com>
Subject Re: REST plugin URL syntax
Date Mon, 16 Jun 2008 20:27:15 GMT
Thanks for the feedback.

I actually disagree regarding whether my url syntax is restful.

Have you read the O'Reilly book: "RESTful Web Services" by Leonard
Richardson; Sam Ruby?

If not please take a look (you can probably see sample chapters on
Safari if you don't have an account).
Specifically in section 5.5.1 Encode Heirarchy into Path Variables
where examples like this are provided:
http://maps.example.com/Earth/France/Paris

In fact the samples the entire book is based on all rely on hierarchy.
Hierarchy is *very* relevant to my problem domain and is something
that a RESTful interface *should* be able to support. Do you not agree
a news website is hierarchical? The web is hierarchical in nature.
REST is supposed to be the language of the web...

If the REST plugin can't support this hierarchical model I'd say it is
fundamentally flawed. I'm happy to help rectify this but to say that
this approach just isn't REST is simply not true.

Can anybody suggest where I would start in an attempt to implement
this hierarchical model? Or do I need to start looking for a
replacement for the Struts2 REST plugin?

Thanks for your time.

Mike

2008/6/17 Al Sutton <al.sutton@alsutton.com>:
> 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
>
>

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


Mime
View raw message