tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Bremford" <mi...@paperx.com>
Subject RE: mod_rewrite Interceptor - feedback please!!
Date Thu, 14 Sep 2000 14:07:22 GMT
Hi Costin

> Before another war starts ( as this is definely not compliant with the
> servlet spec - even worse than the case-sensitive problem ),
> can you tell
> me how does Apache pass this information ?

<g> OK - I can't speak for mod_jk, but in mod_jserv it's passed in as the
field marked as "Script Name". As an example, if I call the URI /miketest,
which is rewritten to /cgi-bin/test, here's my environment.

REQUEST_URI=/miketest
SCRIPT_NAME=/cgi-bin/test
SCRIPT_FILENAME=/export/web/travolta/cgi-bin/test
REDIRECT_URL=/miketest

> What you do is a "special" mapping, common in Apache, IIS,
> NES ( and web
> server ) world, but illegal in servlets. That probably
> means it will never be enabled by default ( I hope we'll find a way to
> check in all the contributed interceptors - in a contrib/
> directory for example).

([OT] - Has anyone contributed a JSSI Interceptor? I share a server with a
guy who's never going to rewrite his code so we can migrate from JServ, but
with an interceptor I won't have to!)

Unfortunately I've come to the same conclusion - a shame, since I've spent
all week on it!

The thing I could never work out is, given a URI which *doesn't* map
directly to a file, how do you split it into Context Path, Servlet Path and
Path Info? What if you redirect from one context to another? (Aargh)

> Let me know how I can help, as I would like this problem
> resolved. Fact  is that servlet API define a ( maybe perfect ) set of
> mapping rules and all other servers use a ( maybe completely stupid
> ) different set of rules, and as long as Apache and other web
> server will persist in mistake and implement the "wrong" mappings they
> implemented for years, we'll have to have a way to  deal with that.

I'm fairly convinced there is no clean way of doing it so that it matches
the behaviour of CGI scripts, at least in 2.2. It would be an interesting
project to duplicate the functionality of mod_rewrite using a 2.3 filter.

If I had to make the call I would say make the rewritten URI become the
actual URI. This means the URI will always map to a physical file, avoiding
the problems above. It also is consistent with the way Resin does it.

I also liked what you were saying about setting an attribute. If people are
using mod_rewrite and if these restrictions are documented AND they can get
at the original URI that was requested, it's not too bad.

I've attached a patch to Apj12ConnectionHandler.java from Tomcat 3.2b3. (I
haven't done mod_jk, but it's a simple patch). Tweak it all you like. I
don't see why it wouldn't work with other webservers, but obviously I
haven't checked it.

>
> Costin
>

Cheers... Mike

Mime
View raw message