[Catalyst] Question on serving files

joeandjackie at boltblue.com joeandjackie at boltblue.com
Fri Feb 16 17:47:14 GMT 2007


Thanks for the replies on this.

My reason for asking was that I didn't want to have a separate Apache config section 
for the directory containing the files. 
Then the request goes though the catalyst url, it gets handled by the catalyst hook and I 
just want the webserver to do that for me.
By the sounds of things I need to set up a separate apache config for that part though.

Thanks again

Joe

Quoting Jonathan Rockway <jon at jrock.us>:

> 
> 
> joeandjackie at boltblue.com wrote:
> > How do I do this through the Catalyst handler & response mechanism?
> 
> Just like you'd serve any other data (see other posts in the thread
> for the details).  Get the data, set the headers, shove it into
> $c->res->body.  You might want to use some sort of sendfile
> implementation, though, for performance reasons.  Using a 100M
> catalyst process to serve spreadsheets is a waste of resources.  (My
> suggestion is to set cache control headers and then let your webserver
> serve future requests from its cache.  Easy to set up, and as fast as
> static pages after the first request.)
> 
> As for getting the directory listings, you'll probably want
> Catalyst::Model::File.  For guessing the types of the files (the
> hardest part of this exercise), File::MMagic::XS looks like a good
> direction to go in.
> 
> Regards,
> Jonathan Rockway
> 
> -- 
> package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
> $,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
> ";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;
> 
> _______________________________________________
> List: Catalyst at 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/
> 


--------------------------------------------------------------
Sent with "Me-Mail", Boltblue's FREE mobile messaging service.
http://www.boltblue.com




More information about the Catalyst mailing list