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::ACTION::DESERIALIZEMULTIPART (3)

.ds Aq ’

NAME

Catalyst::Action::DeserializeMultiPart - Deserialize Data in a Multipart Request

CONTENTS

SYNOPSIS



    package Foo::Controller::Bar;

    __PACKAGE__->config(
        # see Catalyst::Action::Deserialize for standard config
    );

    sub begin :ActionClass(DeserializeMultiPart) DeserializePart(REST) {}



DESCRIPTION

This action will deserialize multipart HTTP POST, PUT, OPTIONS and DELETE requests. It is a simple extension of Catalyst::Action::Deserialize with the exception that rather than using the entire request body (which may contain multiple sections), it will look for a single part in the request body named according to the DeserializePart attribute on that action (defaulting to REST). If a part is found under that name, it then proceeds to deserialize the request as normal based on the content-type of that individual part. If no such part is found, the request would be processed as if no data was sent.

This module’s code will only come into play if the following conditions are met:
o The Content-type of the request is multipart/*
o The request body (as returned by $c-request->body> is not defined
o There is a part of the request body (as returned by $c-request->upload($DeserializePart)>) available

CONFIGURING HTTP::Body

By default, HTTP::Body parses multipart/* requests as an HTTP::Body::OctetStream. HTTP::Body::OctetStream does not separate out the individual parts of the request body. In order to make use of the individual parts, HTTP::Body must be told which content types to map to HTTP::Body::MultiPart. This module makes the assumption that you would like to have all multipart/mixed requests parsed by HTTP::Body::MultiPart module. This is done by a package variable inside HTTP::Body: $HTTP::Body::Types (a HASH ref).

<B>WARNING:B> As this module modifies the behaviour of HTTP::Body globally, adding it to an application can have unintended consequences as multipart bodies will be parsed differently from before.

Feel free to add other content-types to this hash if needed or if you would prefer that multipart/mixed NOT be added to this hash, simply delete it after loading this module.



    # in your controller
    use Catalyst::Action::DeserializeMultiPart;

    delete $HTTP::Body::Types->{multipart/mixed};
    $HTTP::Body::Types->{multipart/my-crazy-content-type} = HTTP::Body::MultiPart;



SEE ALSO

This is a simple sub-class of Catalyst::Action::Deserialize.

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::ACTION::DESERIALIZEMULTIPART (3) 2015-10-29

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