[Catalyst] A different approach to static content
Andy Grundman
andy at hybridized.org
Tue Aug 16 21:08:38 CEST 2005
Christopher H. Laco wrote:
> If I want to serve static mycrap.somenewextension files it should just
> work without having to tell the static plugin its a static file or
> hoping that the mime-types check thinks it's a static file. Past
> installing Apache, serving static content shouldn't involve any extra
> work on the part of the user, or the content creators.
>
> If I want to serve / and /cart from Catalyst and /feedback.htm as a
> static file, it should just work. I shouldn't have to even load the
> Static plugin, or even tweak httpd.conf to exempt .htm from the /
> set-handler used to load the Catalyst app.
>
> I know I'm being a pain the a**, and there are other ways to do it.
> I just think it could be even easier.
You can currently get what you want by simply loading the Static::Simple
plugin. Without requiring any more code or config, it will serve any
file that exists on the filesystem and has a file extension as static,
looking up the MIME type in the MIME::Types mapping, or falling back to
text/plain for everything else. Of course, under Apache your files will
be served slower than they could be. Maybe this is an OK tradeoff for
you. I'm still going to look into DECLINED, though.
Give it a try and let me know how it works out.
-Andy
More information about the Catalyst
mailing list