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

_______________________________________________
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