Is easier than I thought...
I have Apache Web Server set up thusly:
Then in
Tomcat server.xml:
And finally in the web.xml for the application in question:
So I think you can see with this setup, I have something like this:
http://www.myapp.com/SHOW/1/Mike.Curwen http://www.myapp.com/SHOW/2/Big.Moose http://www.myapp.com/SHOW/admin http://www.myapp.com/SHOW/reports The /admin and /reports requests will map to other 'known'
servlets in web.xml (and these work properly).
Anything 'not' recognized will be picked up by my Translating servlet. (the default servlet) It expects certain formats.. meaning #/FirstName.LastName
Never mind the robustness of that.. here is the code within the translator (the code of interest)
So I'm translating from a #/FirstName.LastName format into a queryString that all other parts of my application can use.
Here is what I get when I make a request for
http://www.myapp.com/SHOW/1/Mike.Curwen If I start my newURL (the translated URL) with "/foo?", then this will tell the container to translate the redirect relative to the container root. I don't want that, I want the application root. So I leave it as "foo?". (I've tried it both ways: /foo? gives me a 404, and I'm missing the "/SHOW" token. But if I leave it off.... I get an infinite loop.
It's almost as though somehow the container is determining that
http://www.myapp.com/SHOW/1/Mike.Curwen translates to /SHOW/1 as an application 'root', instead of the expected (?) /SHOW/. So then of course,
http://www.myapp.com/SHOW/1/foo?etcetc is 'unrecognized' and I go through the Translator again.
The 2nd (and subsequent) calls to handleRequest() will attempt to parse foo?etcetc as a FirstName.LastName, and right now I have it defaulting to a
test user (uid=0) when it can't find one.
Am I right in thinking "The container is responsible for turning relative URLs into absolute URLs". I sorta recall reading it somewhere. In this case though, it is not translating them correctly.
Might this be a bug in JK ? In Tomcat? Or is this the expected behaviour?
detail:
Apache/2.0.45 (Unix) mod_jk/1.2.3
Tomcat 4.1.24
JDK 1.4.1
[ July 15, 2003: Message edited by: Mike Curwen ]