[Catalyst] Re: Multi-language and REST

Dave Rolsky autarch at urth.org
Fri Apr 25 23:02:40 BST 2008


On Fri, 25 Apr 2008, Aristotle Pagaltzis wrote:

> * Ashley <apv at sedition.com> [2008-04-25 22:20]:
>> I like PUT and DELETE too but I'm not going to abandon POST as
>> their stand-in (or fall-back) any time soon.
>
> http://search.cpan.org/dist/Catalyst-Request-REST-ForBrowsers/
>
> autarch++

Thanks.

This module illustrates what I'm trying to adopt as a general principle of 
my REST development. Browsers suck, but that doesn't mean the internals of 
my app need to suck as well. You can design the core of your app using 
"strict" REST principles, and then put some shims around the edges to 
handle the real world.

This has the side benefit of giving your app a nice clear internal 
structure. In my controllers, I still have methods like "user_PUT", 
"user_DELETE", "users_POST", etc. If you know REST, you probably have a 
_really_ good idea of what those do.

For the language stuff, you could do something like have a plugin that 
stripped out a language prefix from the URI early on, and then set 
something in the request.

Better yet, you might do something like this:

* check for a URI prefix
* then check Accept-Language

Of course, any sort of URI fixup scheme involves some burden on the part 
of the application to generate the right URIs.


-dave

/*==========================
VegGuide.Org
Your guide to all that's veg
==========================*/



More information about the Catalyst mailing list