You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mike Bremford <mi...@paperx.com> on 2000/09/27 18:24:46 UTC

RE: Using mod_rewrite with Tomcat

(Note - IANATD (I am not a Tomcat Developer :-).

The trouble with using RequestDispatcher.Include as it is that you can't set
any headers - well, nothing useful anyway.

The trouble with duplicating and modifying it so that you can, is that at
the end of the day the URI may not map to a real file. Consider mapping
/bar/foo.jsp to /baz.jsp. Which context should we use? /bar or /ROOT. What
about the pathInfo? When you don't map a URI to a file, deciding how to chop
it up into ContextPath, ServletPath and PathInfo is completely arbitrary.

However, doing it the other way round would work - i.e. returning the
rewritten URI from the getRequestURI(), getServletPath() and friends, and
storing the originally requested URI in an attribute. As luck would have it
I sent in a patch for just this a few weeks ago but it seems to have
disappeared in the maelstrom. It's in the archives at
http://archives2.real-time.com/pipermail/tomcat-devel/2000-September/005853.
html, although it's got lots of annoying "=0A"'s at the end of each line.

Costin et al - forgive the cross-post, and I'm sorry to bring this up AGAIN,
but what did you decide on this? Is something like this going into 3.2
final? I'm trying to document it but I'm not sure what to write!


Cheers... Mike


> -----Original Message-----
> From: Daniel Barclay [mailto:Daniel.Barclay@digitalfocus.com]
> Sent: 27 September 2000 16:51
> To: Mike Bremford
> Cc: tomcat-user@jakarta.apache.org; Mike Bremford
> Subject: Re: Using mod_rewrite with Tomcat
>
>
> Mike Bremford wrote:
> >
> > >From the servlet spec v2.2 section 5.4:
> >
> > "requestURI = contextPath + servletPath + pathInfo"
> >
> > So you can't request /nicepath and have it map to
> /ugly/path.jsp without
> > changing the requestURI to "/ugly/path.jsp". While this is OK, it's
> > different to the behaviour of mod_rewrite for CGI's and for
> Apache/JServ
> > (where ReqeustURI was the original URI and ServletPath was
> the actual path).
>
> Can you apply or borrow any of the behavior of
> Requestdispatcher.include,
> where the original request URI is available through the
> ServletRequest
> methods, and the included servlet's URI is available through standard
> attributes (javax.servlet.include.request_uri, etc.) of the request?
>
> Daniel
> --
> Daniel Barclay
> Digital Focus
> Daniel.Barclay@digitalfocus.com
>