[Catalyst] Re: Catalyst Digest, Vol 23, Issue 86
Greg McAlpin
gmcalpin at sbcglobal.net
Wed Jan 31 16:55:10 GMT 2007
Thanks for taking time to look at this! I wanted to make sure that I wasn't going down a bad path.
Greg
catalyst-request at lists.rawmode.org wrote:
Date: Mon, 29 Jan 2007 21:36:03 -0800
From: Adam Jacob
Subject: Re: [Catalyst] Tweaking REST
To: claco at chrislaco.com, The elegant MVC web framework
Message-ID: <94E045AB-5CF1-470F-B28C-C3A8A5618718 at stalecoffee.org>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
On Jan 29, 2007, at 12:19 PM, Christopher H. Laco wrote:
...
>> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070130/490575b5/attachment-0001.htm
------------------------------
Message: 7
Date: Tue, 30 Jan 2007 21:48:10 -0800
From: Adam Jacob
Subject: Re: [Catalyst] Re: Tweaking REST
To: The elegant MVC web framework
Message-ID: <387C669B-D9A5-4A18-8ED7-BFF96AD90B80 at stalecoffee.org>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
On Jan 30, 2007, at 11:01 AM, Greg McAlpin wrote:
> I would very much appreciate feedback on my approach to using my TT
> view with REST. I'm just playing with the AdventREST example
> trying to understand the whole REST thing.
>
> I created a class (lib/AdventREST/MyREST.pm) for my controllers to
> inherit from. This class inherits from Catalyst::Controller::REST.
>
> In MyREST.pm, I override the 'end' method to either use the
> RenderView ActionClass or the Serialize ActionClass:
>
> sub _renderview : ActionClass('RenderView') {}
> sub _serialize : ActionClass('Serialize') {}
>
> sub end : Private {
> my ($self, $c) = @_;
>
> if ( $self->want_renderview($c) ) {
> $c->forward('_renderview');
> }
> else {
> $c->forward('_serialize');
> }
> where the want_renderview() method can be written however you want
> to (using the Content-Type or file extension or whatever).
That looks totally reasonable to me. What we are talking about it
basically codifying that as a Serialization type, so that people can
pass various content-types through to a given view.
Adam
------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070131/6f06975b/attachment.htm
More information about the Catalyst
mailing list