GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CATALYST::TRAITFOR::REQUEST::REST (3)

.ds Aq ’

NAME

Catalyst::TraitFor::Request::REST - A role to apply to Catalyst::Request giving it REST methods and attributes.

CONTENTS

SYNOPSIS



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

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



DESCRIPTION

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

METHODS

data If the request went through the Deserializer action, this method will return 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:
o Content-type header

If this exists, this will always be the first type in the list.

o content-type parameter

If the request is a GET request and there is a content-type parameter in the query string, this will come before any types in the Accept header.

o Accept header

This will be parsed and the types found will be ordered by the relative quality specified for each type.

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.

AUTHORS

See Catalyst::Action::REST for authors.

LICENSE

You may distribute this code under the same terms as Perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 CATALYST::TRAITFOR::REQUEST::REST (3) 2015-10-29

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.