[Catalyst] Catalyst::Controller::REST and Serializer/Deserializer

Marius Olsthoorn olsthrn at gmail.com
Mon Feb 25 08:59:25 GMT 2013


You can set the (de)serializer to use in the configuration. For example:

    package Foo::Controller::Bar;

    __PACKAGE__->config(
        'default'   => 'application/json',
        'stash_key' => 'rest',
        'map'       => {
            'text/html'             => 'JSON',
            'application/jsonl'  => 'JSON',
        }
    );

I have mapped test/html to JSON here so it will work in the browser.

Seel also:
http://search.cpan.org/~bobtfish/Catalyst-Action-REST-1.06/lib/Catalyst/Action/Serialize.pm#CONFIGURATION

Marius

On 25 February 2013 08:13, Jean-Marc Choulet <jm130794 at gmail.com> wrote:
> Hello,
>
> I'm new to Catalyst and I've certainly a stupid question... I use a
> Catalyst::Controller::REST to implement a web service. My question is : How
> can I force a application/json content-type response when I ask my ws with
> FF or Chrome... ?
>
> Thanks
>
> Jean-Marc
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/



More information about the Catalyst mailing list