[Catalyst] How to print/display some data in an end action

Emmanuel Quevillon tuco at pasteur.fr
Mon May 5 14:24:08 BST 2008


Mitch Jackson wrote:
> Emmanuel,
> 
> Your object is going to request the svg file from your display method,
> just like a web browser would.  When catalyst delivers the file, it
> needs to look like an SVG to the browser.  Some browsers look for
> different things.
> http://www.getsvg.com/implementation_issues/content_type_image_svg_xml
>  Looks like you need to end the URL with ".svg", and also set the
> content type.  You may need to add a "dummy" parameter at the end of
> your url, that you throw away and ignore, so the url looks like a
> .svg.  for example... http://..../display/1/something.svg.  Setting
> the filename, as I recommended, may or may not replace the need for
> this... however, it will make it so if you hit the URL in the web
> browser that it behaves properly.
> 
> You also need to set the content type to image/svg+xml
> 
>  sub end : Private {
>    my($self, $c) = @_;
>    my $g = $c->req->args()->[0];
>    $c->res->content_type( "image/svg+xml" );
>    $c->res->body( $g );
>  }
> 
> Good luck,
> 
> /Mitch
> 
Hi Mitch,

You were right! Thanks a lot.
Adding the '.svg' in the end of my url :
http://.../rg/1.svg

displays correctly the image inside the template!
So I'd like to thank all people who have tried to help me 
with this problem, thinking it is a Catalyst problem. It 
looks like it is more a browser issue.

Cheers

Emmanuel
-- 
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------



More information about the Catalyst mailing list