[Catalyst] Re: Catalyst::Action::REST

A. Pagaltzis pagaltzis at gmx.de
Mon Nov 20 17:51:59 GMT 2006


* Jonathan Rockway <jon at jrock.us> [2006-11-20 17:50]:
> It just occurred to me (after reading Aristotle's post below),
> that it might be a good idea to provide verbs for dumb HTTP
> clients (web browsers). Example:
> 
>    sub foo :Local :ActionClass('REST') {}
>    sub foo_DELETE {}
> 
> This would create URIs:
> 
> foo
> foo/delete
> 
> so that a GET (or POST, which might be better in this case)
> request to foo/delete would do the same thing as a real DELETE
> request.

Yes, POST would be better. Accepting GET on such URIs will only
lead to tears.

> This means that your AJAX and smart HTTP clients could do
> a DELETE /foo/bar, but you could still have a link in the
> browser to /foo/delete/bar.

Exactly, except for the form of URI.

> (Maybe foo/arg0/.../argn/delete would look nicer than
> foo/delete/arg0/.../argn ?)

I would prefer the first. The URI should be as nearly the same as
possible. In fact I’d prefer to put the tunneled method in
a query parameter: `POST /foo/bar?_http_meth=DELETE`.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list