[LUNI] REST url
sean lynch
sean-lynch at sean-lynch.com
Tue Jul 28 09:13:53 CDT 2009
You are correct.
One of the links I sent was about just this problem in the Rails framework.
http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-shallow-routes
Ending up with URLs like:
|http://.../users/1/articles/1/comments/1|
and adding configuration options to side step the defaults and end up
with URLs like:
|http://.../comments/1|
For Rails people to choose configuration over convention is a really big
deal! So you have identified one of the drawbacks of REST. Simple to
understand, once you get the pattern in your head, but very wordy.
Stripes is a Java MVC framework that I believe has RESTful URLs:
http://www.stripesframework.org
http://www.stripesframework.org/display/stripes/Quick+Start+Guide
sean
Jay Strauss wrote:
> Hi,
>
> I understand what you are saying, but what if you need more
> parameters? Like begindate, enddate, ticklength (ie weekly, daily,
> hourly)
>
> Would I end up with a url like:
> ...SPY/begindate/enddate/ticktype
>
> Seems kinda hairy.
>
> I'm just starting this whole adventure into java and rest. I haven't
> decided if and which framework to use. (I can only learn so much at
> once)
>
> Thanks
> Jay
>
> On 7/27/09, sean lynch <sean-lynch at sean-lynch.com> wrote:
>
>> Jay Strauss wrote:
>>
>>> Hi,
>>>
>>> Would:
>>> http://finance.yahoo.com/q/hp?s=SPY
>>>
>>> Be considered a valid REST url? I'm not sure if parameters are
>>> "allowed" on a GET. It seems like all the examples do NOT use parameters.
>>>
>>> Thanks
>>> Jay
>>>
>> Probably should look like:
>>
>> http://finance.yahoo.com/q/hp/s/SPY
>>
>> so parameters are allowed as part of the parsing of urls.
>>
>> Here's a nice discussion about it:
>> http://www.artima.com/weblogs/viewpost.jsp?thread=153170
>>
>>
>> but I would suggest that you choose a framework that supports truly
>> restful urls, then the url formation for that framework will naturally
>> be restful.
>>
>> If your framework has to jump through hoops to produce restful url's
>> then forget the REST or, if you must have REST, switch frameworks.
>>
>> People don't type in url's, they click on them embedded in hyperlinks.
>> Don't try to shoehorn in a RESTful interface.
>>
>> If you work in Rails you will get RESTful URL's. Some PHP and Python
>> frameworks use REST are have good routing mechanisms.
>>
>> I'll note that even frameworks, like Rails, that have truly embraced
>> REST still have trouble handling all cases. Correctly nesting the
>> routing information can get complex if you want super strict RESTful
>> URLs. The Rails people are adding more configuration options to make
>> more sensible choices:
>> http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-shallow-routes
>> That is a big leap for a framework whose mantra is convention over
>> configuration.
>>
>> Work with a framework that already uses REST for a few weeks and the
>> naming will become more natural to you and seem less forced.
>> --
>> Linux Users Of Northern Illinois (Chicago) - Technical Discussion
>> http://luni.org/mailman/listinfo/luni
>>
>>
More information about the LUNI
mailing list