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

Mailing List Archive: Catalyst: Users

Serving a static document

 

 

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


matthew.couchman at bbsrc

Oct 2, 2009, 4:13 AM

Post #1 of 3 (945 views)
Permalink
Serving a static document

Hello,

I'm quite new to Catalyst so apologies if this is a naive question. I'm trying to create a KML document within catalyst and then redirect the server to that document. The problem I'm having is that Catalyst seems to be interpreting the URL of the document (e.g. http://localhost:3000/root/src/test.kml) as a call to a script which it doesn't recognise and so it reverts to the default page. How do I override this behaviour?

Thanks,

Matt.


diment at gmail

Oct 2, 2009, 4:27 AM

Post #2 of 3 (862 views)
Permalink
Re: Serving a static document [In reply to]

On 02/10/2009, at 9:13 PM, matthew couchman (JIC) wrote:

> Hello,
>
> I'm quite new to Catalyst so apologies if this is a naive question.
> I'm trying to create a KML document within catalyst and then
> redirect the server to that document. The problem I'm having is that
> Catalyst seems to be interpreting the URL of the document (e.g. http://localhost:3000/root/src/test.kml)
> as a call to a script which it doesn't recognise and so it reverts
> to the default page. How do I override this behaviour?
>

Something like this (untested):

sub thing :Path('test.kml') {
my ($self, $c) = @_;
$c->serve_static_file('relative/path/from/app/root/to/test.kml');
}

or similar. Catalyst::Plugin::Static::Simple does the dirty work for
you.


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


matthew.couchman at bbsrc

Oct 2, 2009, 8:26 AM

Post #3 of 3 (856 views)
Permalink
RE: Serving a static document [In reply to]

Thanks, I didn't know about Catalyst::Plugin::Static::Simple but that looks like just what I am after.

> -----Original Message-----
> From: Kieren Diment [mailto:diment [at] gmail]
> Sent: 02 October 2009 12:28
> To: The elegant MVC web framework
> Subject: Re: [Catalyst] Serving a static document
>
>
> On 02/10/2009, at 9:13 PM, matthew couchman (JIC) wrote:
>
> > Hello,
> >
> > I'm quite new to Catalyst so apologies if this is a naive question.
> > I'm trying to create a KML document within catalyst and then
> > redirect the server to that document. The problem I'm having is that
> > Catalyst seems to be interpreting the URL of the document (e.g.
> http://localhost:3000/root/src/test.kml)
> > as a call to a script which it doesn't recognise and so it reverts
> > to the default page. How do I override this behaviour?
> >
>
> Something like this (untested):
>
> sub thing :Path('test.kml') {
> my ($self, $c) = @_;
> $c->serve_static_file('relative/path/from/app/root/to/test.kml');
> }
>
> or similar. Catalyst::Plugin::Static::Simple does the dirty work for
> you.
>
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-
> archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/

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

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


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.