From: adam Date: Fri, 1 Dec 2006 08:08:14 +0000 (+0000) Subject: r44@latte: adam | 2006-12-01 00:12:17 -0800 X-Git-Tag: 0.67_01~59 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Action-REST.git;a=commitdiff_plain;h=5e87ec47cf8d08513f3f59195941786d89f2ab10 r44@latte: adam | 2006-12-01 00:12:17 -0800 Fixed some spacing in the Changelog Added some documentation for the re-factored Catalyst::Action::REST --- diff --git a/Changelog b/Changelog index 8f73dd1..b461037 100644 --- a/Changelog +++ b/Changelog @@ -5,12 +5,12 @@ Thu Nov 30 23:51:04 PST 2006 (adam) of the default sub. (daisuke++ pointed out the inconsistency and provided a patch, and I added the foo_not_implemented support) - Added in automated OPTIONS handler, which constructs the allow + Added in automated OPTIONS handler, which constructs the allow header for you, just like the 405 handler. Can be overridden with a normal _METHOD sub. Refactored Test::Rest, so that it uses closures to create the - very similar $test->method() subs. + very similar $test->method() subs. Added tests for Catalyst::Action::REST. diff --git a/lib/Catalyst/Action/REST.pm b/lib/Catalyst/Action/REST.pm index fe63ee9..9411ac2 100644 --- a/lib/Catalyst/Action/REST.pm +++ b/lib/Catalyst/Action/REST.pm @@ -23,7 +23,9 @@ Catalyst::Action::REST - Automated REST Method Dispatching =head1 SYNOPSIS - sub foo :Local :ActionClass('REST') {} + sub foo :Local :ActionClass('REST') { + ... do setup for HTTP method specific handlers ... + } sub foo_GET { ... do something for GET requests ... @@ -44,9 +46,20 @@ the foo_GET method being dispatched. If a method is requested that is not implemented, this action will return a status 405 (Method Not Found). It will populate the "Allow" header -with the list of implemented request methods. +with the list of implemented request methods. You can override this behavior +by implementing a custom 405 handler like so: + + sub foo_not_implemented { + ... handle not implemented methods ... + } + +If you do not provide an _OPTIONS subroutine, we will automatically respond +with a 200 OK. The "Allow" header will be populated with the list of +implemented request methods. -It is likely that you really want to look at L. +It is likely that you really want to look at L, +which brings this class together with automatic Serialization of requests +and responses. =head1 METHODS