<div>Thanks for taking time to look at this! I wanted to make sure that I wasn't going down a bad path.</div> <div> </div> <div>Greg<BR><BR><B><I>catalyst-request@lists.rawmode.org</I></B> wrote:</div> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>Date: Mon, 29 Jan 2007 21:36:03 -0800<BR>From: Adam Jacob <BR>Subject: Re: [Catalyst] Tweaking REST<BR>To: claco@chrislaco.com, The elegant MVC web framework<BR><BR>Message-ID: <94E045AB-5CF1-470F-B28C-C3A8A5618718@stalecoffee.org><BR>Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed<BR><BR>On Jan 29, 2007, at 12:19 PM, Christopher H. Laco wrote:<BR>...<BR>>> As it stands now, REST JustWorks with xml/json stuff. text/html is<BR>>> mapped to YAML::HTML, but I want to map that to my standard TT <BR>>> view.<BR><BR>-------------- next part --------------<BR>An HTML attachment was scrubbed...<BR>URL:
http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070130/490575b5/attachment-0001.htm<BR><BR>------------------------------<BR><BR>Message: 7<BR>Date: Tue, 30 Jan 2007 21:48:10 -0800<BR>From: Adam Jacob <ADAM@STALECOFFEE.ORG><BR>Subject: Re: [Catalyst] Re: Tweaking REST<BR>To: The elegant MVC web framework <CATALYST@LISTS.RAWMODE.ORG><BR>Message-ID: <387C669B-D9A5-4A18-8ED7-BFF96AD90B80@stalecoffee.org><BR>Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed<BR><BR>On Jan 30, 2007, at 11:01 AM, Greg McAlpin wrote:<BR><BR>> I would very much appreciate feedback on my approach to using my TT <BR>> view with REST. I'm just playing with the AdventREST example <BR>> trying to understand the whole REST thing.<BR>><BR>> I created a class (lib/AdventREST/MyREST.pm) for my controllers to <BR>> inherit from. This class inherits from Catalyst::Controller::REST.<BR>><BR>> In MyREST.pm, I override the 'end' method to either use the
<BR>> RenderView ActionClass or the Serialize ActionClass:<BR>><BR>> sub _renderview : ActionClass('RenderView') {}<BR>> sub _serialize : ActionClass('Serialize') {}<BR>><BR>> sub end : Private {<BR>> my ($self, $c) = @_;<BR>><BR>> if ( $self->want_renderview($c) ) {<BR>> $c->forward('_renderview');<BR>> }<BR>> else {<BR>> $c->forward('_serialize');<BR>> }<BR>> where the want_renderview() method can be written however you want <BR>> to (using the Content-Type or file extension or whatever).<BR><BR>That looks totally reasonable to me. What we are talking about it <BR>basically codifying that as a Serialization type, so that people can <BR>pass various content-types through to a given view.<BR><BR>Adam<BR><BR><BR><BR>------------------------------<BR></BLOCKQUOTE>