Michael Peters wrote:
Timothy Appnel wrote:
On 1/2/07, Jaldhar H. Vyas <[EMAIL PROTECTED]> wrote:

I like the way Catalyst::Action::REST implements its REST
functionality personally.
You mean with attributes?
No, through method naming conventions such as...

  entry_POST
  entry_GET
  entry_PUT

...where entry is the defined runmode. If a runmode_HTTPMETHOD doesn't
exist the dispatcher automatically returns a method is not supported
HTTP status method.

I've been thinking a bit on how to do this. It should be trivial to implement in
Dispatch, but I want to run the syntax by everyone.

First off, I would like to allow users to be explicit or just use convention. So
you could have a rule like this:

  '/app/:module/:rm' => { auto_rest => 1 }

And it would append the HTTP method name (lowercased?) to the run mode. So
'/app/module/entry' would become
  Module->entry_get
  Module->entry_post
  Module->entry_delete
  Module->entry_put

And if a method is attempted for which there is no run mode, then it would be
the normal rm-not-found thing.

Next, I'd like to allow users to be explicit in HTTP method mapping:

  '/app/:module/stuff[get]' => { rm => 'get_stuff' }
Being explicit is good, as one could imagine situations where the default mapping might not make good sense. I'm just curious, but assuming most of this is going to be used with a browser, how is one making PUT and DELETE requests, since it seems that many browsers either do not support these two methods or do not implement them the same way? One way I have seen is to have a fallback to POST with a hidden field of name "_method" and value either "PUT" or "DELETE" to simulate the behavior. What do people envision is happening on the client end?

Thanks,
Sean

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to