Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 89742 invoked from network); 16 Jun 2008 20:28:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jun 2008 20:28:12 -0000 Received: (qmail 10156 invoked by uid 500); 16 Jun 2008 20:28:03 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 10131 invoked by uid 500); 16 Jun 2008 20:28:03 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 10120 invoked by uid 99); 16 Jun 2008 20:28:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jun 2008 13:28:03 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of michael.f.watson@gmail.com designates 74.125.46.31 as permitted sender) Received: from [74.125.46.31] (HELO yw-out-2324.google.com) (74.125.46.31) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jun 2008 20:27:11 +0000 Received: by yw-out-2324.google.com with SMTP id 9so2793995ywe.17 for ; Mon, 16 Jun 2008 13:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=ctEvgZC5nwhLpeRxxHvd9WX6AV/occIT7jf9zb8nULY=; b=Kyn6aAzdSUSv3Q0o2bZvJJw0ZLcfx7ExScU741wGKpSPa8BvTGmjDxMRJW6HZZHI5M DLIokXEcJcVAcA6Q0yBPht8d3D7XHKyD7u4BvP4ZDLB9g8dV2wT1USAqix+LvcK3tS0q Y4U7PbBXNTBXprTuNqWGZpmMGcN0PsMuTvTCA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=rI6GIls6RmnhpqO4mfkSaYMkllcv+kb9ky2ypLvSHa2HbCFE9yGAELF1jXUwt5sga8 3mP8pD7l32W80xVO3YPhobgVezHXokPv1Ul4gKzJInio6LSLRP+Oin8K+2LxQTVhZmWx J0WkF1s5U7hbQ5M2MPmSRUkPYM1Xgzx6EuKYA= Received: by 10.151.114.7 with SMTP id r7mr11436697ybm.191.1213648035791; Mon, 16 Jun 2008 13:27:15 -0700 (PDT) Received: by 10.151.98.6 with HTTP; Mon, 16 Jun 2008 13:27:15 -0700 (PDT) Message-ID: <7675ea080806161327v77c994a3v26ae82c1cb6152a2@mail.gmail.com> Date: Tue, 17 Jun 2008 08:27:15 +1200 From: "Mike Watson" To: "Struts Users Mailing List" Subject: Re: REST plugin URL syntax In-Reply-To: <4856C8F8.8010508@alsutton.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7675ea080806151522x4daf270ap8ab450c3d9f4fbae@mail.gmail.com> <48560EDA.4070609@alsutton.com> <4856C8F8.8010508@alsutton.com> X-Virus-Checked: Checked by ClamAV on apache.org 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 : > 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