Christopher H. Laco wrote:
> I'm needing to support RSS/Atom feeds of some of my cart/wishlist data.
> The lazy guy in me says I can just make a view or two and be done with
> it (Thanks for the code LTjake!). The anal retentive programmer in me
> says I probably really want to use C::A::REST to get the benefit of
> mime-type request mapping and de/serialization for other things that
> might come along, like json/yaml.
> 
> On top of that, I want things to also work by extension: .json, .atom,
> .rss etc. That's where C::P::Flavour enters the picture.
> 
> As it stands now, REST JustWorks with xml/json stuff. text/html is
> mapped to YAML::HTML, but I want to map that to my standard TT view. As
> for RSS/Atom, I'd need a Serializer for them, which in the end isn't
> really different than writing a view.
> 
> For the extension mapping, I was just going to do something like this in
> my begin before deserialization happens:
> 
>   $c->request->content_type(
>     MIME::Types->new->mimeTypeOf($c->flavour)
>   ) if $c->flavour;
> 
> I'll have to add some missing mime-type, but that's no biggie.
> 
> In the end, this seems to be a struggle between content-types, views,
> and/or rest. They're all nice, just all unattached from each other.
> 
> Is there a better way?
> 
> -=Chris

Letting some thoughts flow... (usually bad ideas)...

+Catalyst::Action::Serialize::View

> __PACKAGE__->config(
>   serialize => {
>     'stash_key' => 'rest',
>     'map'       => {
>       'text/html' => ['View', 'TT'],
>       'application/atom+xml' => ['View', 'Atom'],
>     },
>   }
> );

That cleans up that end, which only leaves magic between Flavour, adding
missing mime-types, and setting content-type if an extension is used...

-=Chris

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to