httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graham Dumpleton" <graham.dumple...@gmail.com>
Subject Re: translate_name and/or map_to_storage hooks
Date Thu, 05 Apr 2007 02:45:12 GMT
On 05/04/07, Sam Carleton <scarleton@gmail.com> wrote:
> On 4/4/07, Sam Carleton <scarleton@gmail.com> wrote:
> > On 3/27/07, Sam Carleton <scarleton@gmail.com> wrote:
> > > On 3/27/07, Issac Goldstand <margol@beamartyr.net> wrote:
> > >
> > > > > More importantly,  lets say my module is called mod_coolapp and when
I
> > > > > have it installed, you get to it at /coolapp.  I want /coolapp to
be
> > > > > the equivalent to the index.php and then have say, /coolapp/images
be
> > > > > the same as imageHandler.php.  Is there any trick to knowing which
> > > > > "page" is being requested or is it simply a matter of doing a string
> > > > > compare to see if the first part of the string passed the actual
URL
> > > > > (/coolapp/) is images?
> > > > >
 > > > > You're going to want to parse/compare the string.  The "Right Way(tm)"
> > > > to do this would probably be during the translate_name or possibly
> > > > map_to_storage hooks to separate the URI mapping logic from the actual
> > > > response processing logic.
> > >
> > > You totally lost me with the "translate_name" and "map_to_storage", I
> > > will have to do some reading on it.
> >
> > Issac,
> >
> > I am not exactly sure how I would leverage either the translate_name
> > hook or map_to_storage hook.  The best I can figure is that I should
> > hook translate_name and this is the translation:
> >
> > /coolapp?<params> --> /coolapp?type=index&<params>
> >
> > /coolapp/images?<params> --> /coolapp?type=image&<params>
> >
> > Do I have the right idea?
>
> I have been trying to move forward with the assumption that I am on
> the right track and continue to run unknowns.  How do I identify
> coolapp as the location?  In other words, I have this in my
> httpd.conf:
>
> <Location /coolapp>
>     SetHandler my_cool_app
> </Location>
>
> Inside of the translate_name hook, how do I go about determining that
> /coolapp is the location?

I missed out on the start of this conversion so really don't know what
you are trying to do, but look at the source code for mod_alias in
Apache as an example of how you can match a URI location to a specific
resource in a translate name handler. In the case of mod_alias it
matches it to a physical direction and applies different meanings to
it depend on whether you are using Alias or ScriptAlias style
directives.

BTW, if all you are wanting to do is translate stuff like:

  /coolapp?<params> --> /coolapp?type=index&<params>

  /coolapp/images?<params> --> /coolapp?type=image&<params>

why aren't you just using mod_rewrite?

Graham

Mime
View raw message