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

Jean-Marc Choulet jm130794 at gmail.com
Tue Feb 26 11:48:00 GMT 2013


Le 25/02/2013 09:59, Marius Olsthoorn a écrit :
> 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/
> _______________________________________________
> 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/
Hello Marius,

Great ! That works :)

Thanks you,

Jean-Marc



More information about the Catalyst mailing list