Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

How to print/display some data in an end action

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


tuco at pasteur

Apr 30, 2008, 2:51 AM

Post #1 of 14 (669 views)
Permalink
How to print/display some data in an end action

Hi,

I'd like to incorporate an action into an <object> tag that
only prints some data (XML SVG).
I have an action in a controller Foo that do this :

sub display : Local : Args(1) {
....
my $t = $object->display_graph();
$c->detach('Foo', 'end', [$t]);
}

sub end : Private {
my($self, $c) = @_;
my $g = $c->req->args()->[0];
print $g;
}

then in a template :

<object data="http://..../display/1"></object>

However, my output remains empty in my template.
If I directly call the 'display' action from my browser as :

http://.../display/1, it works ok although I get some extra
code from Catalyst :

1HTTP/1.0 200 OK
Connection: close
Date: Wed, 30 Apr 2008 09:47:49 GMT
Status: 200
X-Catalyst: 5.7012

and so an xml error parsing reported.

So my questions are:

1: Do I do this the best way?
2: If so, how to avoid to print this extra code from catalyst?

Thanks in advance

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

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


omega at palle

Apr 30, 2008, 3:29 AM

Post #2 of 14 (649 views)
Permalink
Re: How to print/display some data in an end action [In reply to]

On Apr 30, 2008, at 11:51 AM, Emmanuel Quevillon wrote:

> Hi,
>
> I'd like to incorporate an action into an <object> tag that only
> prints some data (XML SVG).
> I have an action in a controller Foo that do this :
>
> sub display : Local : Args(1) {
> ....
> my $t = $object->display_graph();
> $c->detach('Foo', 'end', [$t]);
> }
>
> sub end : Private {
> my($self, $c) = @_;
> my $g = $c->req->args()->[0];
> print $g;
> }


Never use print.

use $c->res->write[2], or set $c->res->body[1].


- andreas

[1]: http://cpansearch.perl.org/~mramberg/Catalyst-Runtime-5.7012/lib/Catalyst/Response.pm#$res-%3Ebody(%3C$text
|$fh|$iofh_object)
[2]: http://cpansearch.perl.org/~mramberg/Catalyst-Runtime-5.7012/lib/Catalyst/Response.pm#$res-%3Ewrite(_$data_)

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


tuco at pasteur

Apr 30, 2008, 5:50 AM

Post #3 of 14 (648 views)
Permalink
Re: How to print/display some data in an end action [In reply to]

Andreas Marienborg wrote:
>
> On Apr 30, 2008, at 11:51 AM, Emmanuel Quevillon wrote:
>
>> Hi,
>>
>> I'd like to incorporate an action into an <object> tag that only
>> prints some data (XML SVG).
>> I have an action in a controller Foo that do this :
>>
>> sub display : Local : Args(1) {
>> ....
>> my $t = $object->display_graph();
>> $c->detach('Foo', 'end', [$t]);
>> }
>>
>> sub end : Private {
>> my($self, $c) = @_;
>> my $g = $c->req->args()->[0];
>> print $g;
>> }
>
>
> Never use print.
>
> use $c->res->write[2], or set $c->res->body[1].
>
>
> - andreas
>
> [1]:
> http://cpansearch.perl.org/~mramberg/Catalyst-Runtime-5.7012/lib/Catalyst/Response.pm#$res-%3Ebody(%3C$text|$fh|$iofh_object)
>
> [2]:
> http://cpansearch.perl.org/~mramberg/Catalyst-Runtime-5.7012/lib/Catalyst/Response.pm#$res-%3Ewrite(_$data_)
>
Hi Andreas,

Thanks for your reply. I tried your solutions without
success. Catalyst always try to wrap the action result
'display' into a template. However I don't want it, I just
want an action that throw data when called. I get an error
from Catalyst saying it cannot find the template 'display.tt2'.
Cheers

Emmanuel


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

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


pagaltzis at gmx

Apr 30, 2008, 6:24 AM

Post #4 of 14 (646 views)
Permalink
Re: How to print/display some data in an end action [In reply to]

* Emmanuel Quevillon <tuco[at]pasteur.fr> [2008-04-30 15:05]:
> Catalyst always try to wrap the action result 'display' into a
> template.

No, it doesn’t. If that happens in your app, then you have set it
up to happen like that. But the code you pasted does not include
that portion, so no one will be able tell you what to do instead.

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


perimus at gmail

Apr 30, 2008, 6:46 AM

Post #5 of 14 (647 views)
Permalink
Re: How to print/display some data in an end action [In reply to]

Emmanuel,

You can store the data into the stash, and create a template for it.
Don't forget to set your content type, or whatever is receiving the
XML may not like it. I also prefer to send a filename.

sub display : Local : Args(1) {
....
my $t = $object->display_graph();
$c->stash->{xml} = $t;
$c->stash->{template} = 'xml.tt2';

# Set content type
$c->response->content_type( 'text/xml' );

# Ask IE6, a cache offender on XML documents, to not cache this XML response
$c->response->header( Pragma => 'no-cache' );
$c->response->header( Expires => '-1' );

# Set filename
$c->response->header( 'Content-disposition', "attachment;
filename=myfile-2008-04-30.xml" );
}

.... xml.tt2
[% xml %]

If you happen to be using TTSite, you will probably have to open up
root/lib/config/col and change the closing brace at the end from %] to
-%] so it does not insert an empty line break before your content,
breaking your XML document. ( By the standards, they can't begin with
a blank line )

/Mitchell K. Jackson

On Wed, Apr 30, 2008 at 4:51 AM, Emmanuel Quevillon <tuco[at]pasteur.fr> wrote:
> Hi,
>
> I'd like to incorporate an action into an <object> tag that only prints
> some data (XML SVG).
> I have an action in a controller Foo that do this :
>
> sub display : Local : Args(1) {
> ....
> my $t = $object->display_graph();
> $c->detach('Foo', 'end', [$t]);
> }
>
> sub end : Private {
> my($self, $c) = @_;
> my $g = $c->req->args()->[0];
> print $g;
> }
>
> then in a template :
>
> <object data="http://..../display/1"></object>
>
> However, my output remains empty in my template.
> If I directly call the 'display' action from my browser as :
>
> http://.../display/1, it works ok although I get some extra code from
> Catalyst :
>
> 1HTTP/1.0 200 OK
> Connection: close
> Date: Wed, 30 Apr 2008 09:47:49 GMT
> Status: 200
> X-Catalyst: 5.7012
>
> and so an xml error parsing reported.
>
> So my questions are:
>
> 1: Do I do this the best way?
> 2: If so, how to avoid to print this extra code from catalyst?
>
> Thanks in advance
>
> --
> -------------------------
> Emmanuel Quevillon
> Biological Software and Databases Group
> Institut Pasteur
> +33 1 44 38 95 98
> tuco at_ pasteur dot fr
> -------------------------
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


tuco at pasteur

Apr 30, 2008, 7:16 AM

Post #6 of 14 (647 views)
Permalink
Re: Re: How to print/display some data in an end action [In reply to]

Aristotle Pagaltzis wrote:
> * Emmanuel Quevillon <tuco[at]pasteur.fr> [2008-04-30 15:05]:
>> Catalyst always try to wrap the action result 'display' into a
>> template.
>
> No, it doesn’t. If that happens in your app, then you have set it
> up to happen like that. But the code you pasted does not include
> that portion, so no one will be able tell you what to do instead.
>
> Regards,


Thanks Aristotle,


Maybe I can clarify the situation.

In controller Foo I have 2 methods:

sub bar : LocalRegex ('^(\d+)$') {

my($self, $c) = @_;

my $id = $c->req->captures->[0];
$c->detach(qw/Root _softwareError/,
["An id is required to get related genes."])
unless $id;

$c->stash()->{url} = $c->uri_for("/admin/rg/$id");
$c->stash()->{template} = 'admin/relatedgenes.tt2';
$c->detach('View::TT');

}

sub rg : Local : Args(1) {


my($self, $c) = @_;

my $id = $c->req->args->[0];
$c->detach(qw/Root _softwareError/,
["An id is required to get related genes."])
unless $id;

my $gr = GeneRelations->new(
%{$c->config()->{dbinfos}},
org => $c->session()->{org}->{id_org},
);

my $t = $gr->display_graph(type => 'id_gene', value =>
$id);
$c->res->write($t);
$c->forward('Root', 'end');

}


Template 'admin/relatedgenes.tt2' contains an <object> tag as :

<object data="[% url %]" width="100%" height="100%"></object>

with [% url %] value coming from 'Foo::bar'
here: <object data="http://..../rg/<id>"></object>

I know that <object> tag can contain an url to be call on
load, and that's what I want to do with My app to avoid
storing svg files. If I put url for a svg image it works
fine. But I don't want to store temp files.

I hope the situation will be clearer like this and someone
will be able to give clues or solutions.

Thanks in advance

Emmanuel

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


_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


pagaltzis at gmx

Apr 30, 2008, 2:38 PM

Post #7 of 14 (645 views)
Permalink
Re: How to print/display some data in an end action [In reply to]

Hi Emmanuel,

* Emmanuel Quevillon <tuco[at]pasteur.fr> [2008-04-30 16:30]:
> Maybe I can clarify the situation.

OK; but all of that was already reasonably obvious. The issue is,
you are doing something to forward to ::View::TT automatically at
the end of a request. Catalyst does not do that by itself. So the
problem would have to be fixed there. First question: what does
the `end` action in your Root controller do? Do you have any other
`end`s? If so, what do those do?

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


omega at palle

May 1, 2008, 1:41 AM

Post #8 of 14 (634 views)
Permalink
Re: Re: How to print/display some data in an end action [In reply to]

On Apr 30, 2008, at 4:16 PM, Emmanuel Quevillon wrote:

> Aristotle Pagaltzis wrote:
>> * Emmanuel Quevillon <tuco[at]pasteur.fr> [2008-04-30 15:05]:
>>> Catalyst always try to wrap the action result 'display' into a
>>> template.
>> No, it doesn’t. If that happens in your app, then you have set it
>> up to happen like that. But the code you pasted does not include
>> that portion, so no one will be able tell you what to do instead.
>> Regards,
>
>
> Thanks Aristotle,
>
>
> Maybe I can clarify the situation.
>
> In controller Foo I have 2 methods:
>
> sub bar : LocalRegex ('^(\d+)$') {
>
> my($self, $c) = @_;
>
> my $id = $c->req->captures->[0];
> $c->detach(qw/Root _softwareError/,
> ["An id is required to get related genes."])
> unless $id;
>
> $c->stash()->{url} = $c->uri_for("/admin/rg/$id");
> $c->stash()->{template} = 'admin/relatedgenes.tt2';
> $c->detach('View::TT');
>
> }
>
> sub rg : Local : Args(1) {
>
>
> my($self, $c) = @_;
>
> my $id = $c->req->args->[0];
> $c->detach(qw/Root _softwareError/,
> ["An id is required to get related genes."])
> unless $id;
>
> my $gr = GeneRelations->new(
> %{$c->config()->{dbinfos}},
> org => $c->session()->{org}->{id_org},
> );
>
> my $t = $gr->display_graph(type => 'id_gene', value => $id);
> $c->res->write($t);
> $c->forward('Root', 'end');
>
> }
>
>
> Template 'admin/relatedgenes.tt2' contains an <object> tag as :
>
> <object data="[% url %]" width="100%" height="100%"></object>
>
> with [% url %] value coming from 'Foo::bar'
> here: <object data="http://..../rg/<id>"></object>
>
> I know that <object> tag can contain an url to be call on load, and
> that's what I want to do with My app to avoid storing svg files. If
> I put url for a svg image it works fine. But I don't want to store
> temp files.
>
> I hope the situation will be clearer like this and someone will be
> able to give clues or solutions.


Most likely your Root's end action forwards to a view. If you use the
RenderView action-class, it shouldn't do that if the body is set.

I would change the rg actions last few lines to something like this:


$c->res->body($t);
$c->res->content_type('your/content-type');
}

No point in forwarding to end, since that is done automaticly.

If you don't use RenderView, you need to post your roots end action if
we are to help you figure out whats up there.

- andreas


_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


pagaltzis at gmx

May 1, 2008, 3:48 AM

Post #9 of 14 (627 views)
Permalink
Re: How to print/display some data in an end action [In reply to]

* Andreas Marienborg <omega[at]palle.net> [2008-05-01 10:50]:
> No point in forwarding to end, since that is done automaticly.

In which case it would run twice, actually. But maybe he has a
more specific `end` action and so forwarding to ::C::Root::end
is actually a useful thing to do in his app. As I said, we have
seen too little of the code to make any meaningful suggestions.

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


tuco at pasteur

May 4, 2008, 11:46 PM

Post #10 of 14 (584 views)
Permalink
Re: Re: How to print/display some data in an end action [In reply to]

Aristotle Pagaltzis wrote:
> Hi Emmanuel,
>
> * Emmanuel Quevillon <tuco[at]pasteur.fr> [2008-04-30 16:30]:
>> Maybe I can clarify the situation.
>
> OK; but all of that was already reasonably obvious. The issue is,
> you are doing something to forward to ::View::TT automatically at
> the end of a request. Catalyst does not do that by itself. So the
> problem would have to be fixed there. First question: what does
> the `end` action in your Root controller do? Do you have any other
> `end`s? If so, what do those do?
>
> Regards,
Hi Aristotle,

My Root::end action is simply :

sub end : ActionClass(RenderView) { }

And I don't have any other end action in other controllers.

Regards

Emmanuel

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

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


tuco at pasteur

May 5, 2008, 12:29 AM

Post #11 of 14 (583 views)
Permalink
Re: Re: How to print/display some data in an end action [In reply to]

Aristotle Pagaltzis wrote:
> * Andreas Marienborg <omega[at]palle.net> [2008-05-01 10:50]:
>> No point in forwarding to end, since that is done automaticly.
>
> In which case it would run twice, actually. But maybe he has a
> more specific `end` action and so forwarding to ::C::Root::end
> is actually a useful thing to do in his app. As I said, we have
> seen too little of the code to make any meaningful suggestions.
>
> Regards,


Hi Aristotle,

You're right, Root/end action is called twice :

| /auto | 0.002877s |
| /admin/auto | 0.001081s |
| /admin/display | 0.136538s |
| -> MycoBiblio::View::TT->process
| 0.098517s |
| /end | 0.000431s |

...
...

| /auto | 0.002108s |
| /admin/auto | 0.000884s |
| /admin/rg | 0.053757s |
| /end | 0.000521s |

We see that in the first call list, the template is well
called and process correctly as asked in the 'display' code
action method.
Then the first 'end' call.

Then as in the 'execute' method from C::A::RenderView, it is
forwarded to the appropriate view, so in 'display' to
'C::V::TT'.

Then, in the second 'end' call, nothing is forwarded to any
view as it is asked in C::A::RenderView 'execute' action.

So this is the behavior I wanted :) even if 'end' is called
twice.


From C::A::RenderView
---------------------

sub execute {
my $self = shift;
my ($controller, $c ) = @_;
$self->NEXT::execute( @_ );
...
...
return 1 if $c->req->method eq 'HEAD';
return 1 if defined $c->response->body && length(
$c->response->body );
return 1 if scalar @{ $c->error } &&
!$c->stash->{template};
return 1 if $c->response->status =~ /^(?:204|3\d\d)$/;
my $view = $c->view()
|| die "Catalyst::Action::RenderView could not find
a view to forward to.\n";
$c->forward( $view );
};
--
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


diment at gmail

May 5, 2008, 12:48 AM

Post #12 of 14 (585 views)
Permalink
Re: Re: How to print/display some data in an end action [In reply to]

On 5 May 2008, at 16:46, Emmanuel Quevillon wrote:

> Aristotle Pagaltzis wrote:
>> Hi Emmanuel,
>> * Emmanuel Quevillon <tuco[at]pasteur.fr> [2008-04-30 16:30]:
>>> Maybe I can clarify the situation.
>> OK; but all of that was already reasonably obvious. The issue is,
>> you are doing something to forward to ::View::TT automatically at
>> the end of a request. Catalyst does not do that by itself. So the
>> problem would have to be fixed there. First question: what does
>> the `end` action in your Root controller do? Do you have any other
>> `end`s? If so, what do those do?
>> Regards,
> Hi Aristotle,
>
> My Root::end action is simply :
>
> sub end : ActionClass(RenderView) {

my ($self, $c) = @_;
my $whatever = do_stuff()
$c->stash->{whatever} = $whatever

> }
>
> And I don't have any other end action in other controllers.
>
> Regards
>
> Emmanuel
>
> --
> -------------------------
> Emmanuel Quevillon
> Biological Software and Databases Group
> Institut Pasteur
>

Quesque c'es faire l'institute pasteur avec catalyst?

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


dbix-class at trout

May 5, 2008, 4:04 AM

Post #13 of 14 (582 views)
Permalink
Re: Re: How to print/display some data in an end action [In reply to]

On Wed, Apr 30, 2008 at 04:16:00PM +0200, Emmanuel Quevillon wrote:
> Aristotle Pagaltzis wrote:
> >* Emmanuel Quevillon <tuco[at]pasteur.fr> [2008-04-30 15:05]:
> >>Catalyst always try to wrap the action result 'display' into a
> >>template.
> >
> >No, it doesn’t. If that happens in your app, then you have set it
> >up to happen like that. But the code you pasted does not include
> >that portion, so no one will be able tell you what to do instead.
> >
> >Regards,
>
>
> Thanks Aristotle,
>
>
> Maybe I can clarify the situation.
>
> In controller Foo I have 2 methods:
>
> sub bar : LocalRegex ('^(\d+)$') {
>
> my($self, $c) = @_;
>
> my $id = $c->req->captures->[0];
> $c->detach(qw/Root _softwareError/,
> ["An id is required to get related genes."])
> unless $id;
>
> $c->stash()->{url} = $c->uri_for("/admin/rg/$id");
> $c->stash()->{template} = 'admin/relatedgenes.tt2';

Delete this line, your end action will already do it.

> $c->detach('View::TT');

> }
>
> sub rg : Local : Args(1) {
>
>
> my($self, $c) = @_;
>
> my $id = $c->req->args->[0];
> $c->detach(qw/Root _softwareError/,
> ["An id is required to get related genes."])
> unless $id;
>
> my $gr = GeneRelations->new(
> %{$c->config()->{dbinfos}},
> org => $c->session()->{org}->{id_org},
> );
>
> my $t = $gr->display_graph(type => 'id_gene', value =>
> $id);
> $c->res->write($t);

Delete this one too, that's going to make end() be run twice.

> $c->forward('Root', 'end');

> }

Once you've fixed those, all you should need to do is make sure there's
something in $t and RenderView won't call the TT view at all for rg.

--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


tuco at pasteur

May 5, 2008, 6:24 AM

Post #14 of 14 (580 views)
Permalink
Re: How to print/display some data in an end action [In reply to]

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
-------------------------

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.