J. Shirley > Catalyst-Action-REST-0.66 > Catalyst::Request::REST

Download:
Catalyst-Action-REST-0.66.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  5
Open  15
View/Report Bugs
Source   Latest Release: Catalyst-Action-REST-1.17

NAME ^

Catalyst::Request::REST - A REST-y subclass of Catalyst::Request

SYNOPSIS ^

     if ( $c->request->accepts('application/json') ) {
         ...
     }

     my $types = $c->request->accepted_content_types();

DESCRIPTION ^

This is a subclass of Catalyst::Request that adds a few methods to the request object to faciliate writing REST-y code. Currently, these methods are all related to the content types accepted by the client.

METHODS ^

If the request went through the Deserializer action, this method will returned the deserialized data structure.

accepted_content_types

Returns an array reference of content types accepted by the client.

The list of types is created by looking at the following sources:

If a type appears in more than one of these places, it is ordered based on where it is first found.

preferred_content_type

This returns the first content type found. It is shorthand for:

  $request->accepted_content_types->[0]

accepts($type)

Given a content type, this returns true if the type is accepted.

Note that this does not do any wildcard expansion of types.

AUTHOR ^

Adam Jacob <adam@stalecoffee.org>, with lots of help from mst and jrockway

LICENSE ^

You may distribute this code under the same terms as Perl itself.

syntax highlighting: