1 package Catalyst::Controller::REST;
5 use base 'Catalyst::Controller';
6 use Params::Validate qw(:all);
8 __PACKAGE__->mk_accessors(qw(serialize));
13 'stash_key' => 'rest',
15 'text/x-yaml' => 'YAML',
16 'text/x-data-dumper' => [ 'Data::Serializer', 'Data::Dumper' ],
21 sub begin : ActionClass('Deserialize') {}
23 sub end : ActionClass('Serialize') { }
30 location => { type => SCALAR | OBJECT },
31 entity => { optional => 1 },
36 if (ref($p{'location'})) {
37 $location = $p{'location'}->as_string;
39 $c->response->status(201);
40 $c->response->header('Location' => $location);
41 if (exists($p{'entity'})) {
42 $c->stash->{$self->config->{'serialize'}->{'stash_key'}} = $p{'entity'};