On Mon, 2003-09-08 at 11:51, Steve Hay wrote:
> 
> It also needs to have access to various static resources (images, 
> stylesheets, JavaScript libraries etc.).
> 
> Thus, I want to have something like this:
> 
> /myproject                 [mp1]
> /myproject/component1   [mp1]
> /myproject/component2   [mp1]
> ...
> /myproject/images       [static]
> /myproject/javascript   [static]
> /myproject/stylesheets  [static]

You might want to look at having a translation handler.

We're doing something similar to this, where images and javascripts live
under the same directory structure as the handler is managing.  Instead
of trying to configure this via that httpd.conf file, we chose to have a
translation handler look at the incoming uri and determine whether the
request is for a static file or for the code.

Inside of our transhandler we're doing this:

sub handler
{
        my $r=shift;
        my $uri=$r->uri;
        my $Tmplpath="/our/static/files/rootdir/";

        if (($uri !~ /jpg$/) && ($uri !~ /css$/) && ($uri !~ /js$/))
        {
                $r->notes('host' => "$Host");
                $r->notes('olduri' => "$uri");
                $r->uri("/");
                return DECLINED;
        }
        else
        {
                my $File=$Tmplpath . $uri;
                $r->filename("$File");
                return OK;
        }
}

If a request is made for anything ending in .jpg, .js or .css, we tell
apache where to find the file by appending the uri (/images/the.jpg for
example) to a path.  The handler then returns OK, which tells apache not
to try to figure out where the file lives on its own, and returns the
file to the browser.

Any other request is passed to the handler, along with a field in
notes() that shows what we were asking for in the first place.  Our
request handler uses this to dispatch the request to the correct object
needed to fulfill the request.  (Our handler is configured at /, so we
override the uri passed from the browser to /).

Any other types you want can be added to this, I just threw the ones
that seemed relevant to you.  I hope this helps.

Marc Slagle
Whapps LLC

Reply via email to