struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Thiebaud <cthieb...@stylo.it>
Subject Re: Incorrect (?) handling of path identification when using Apache+Tomcat+Struts
Date Fri, 06 Oct 2000 12:51:24 GMT
In my case, after several trial and error I eventually did succeed in
implementing Apache's Smart Context Redirection.

I seems that the following lines:

AddType test/jsp .jsp
AddHandler jserv-servlet .jsp
AddHandler jserv-servlet .do

In my tomcat-apache.conf do the work.

my JSPs and servlets and actions.do work fine, 
and I can see clearly in the apache log that it serves the BMPs, CSS, and
various other files.

The problem is that it seems that a request handled directly by Tomcat
(i.e. http://foo.com:8080/foo.do)
and a request handled over apache 
(i.e. http://foo.com/foo.do)
differs slightly in their PathInfo attribute

http://foo.com:8080/foo.do => getPathInfo return null
http://foo.com/foo.do => getPathInfo return ""

I worked around the problem by subclassing the class ActionServlet and
implementing the correct test myself. (see bottom of mail)


On Thu, 05 Oct 2000, you wrote:
> I got the same error. In my case, the 400 error was coming from Apache, not
> Tomcat. Under the "Smart" context redirection, Apache was handling
> everything but jsps (URI matching "*.jsp") and what it thought were servlets
> (URI matching "*/servlet/*". The URI used by struts didn'ty fit the pattern,
> so Apache never sent them to Tomcat. I ended up going to a minimalist
> configuration, but I assume you could also direct Apache to send *.do URIs
> to Tomcat, or change Strut's URIs to servler/*.
> 
> ----- Original Message -----
> From: "Christophe Thiebaud" <cthiebaud@stylo.it>
> To: <struts-user@jakarta.apache.org>
> Sent: Wednesday, October 04, 2000 6:07 AM
> Subject: Incorrect (?) handling of path identification when using
> Apache+Tomcat+Struts
> 
> 
> > Hi everybody,
> >
> > when I access my 'foo' struts-based application through
> > http://foo.com:8080/foo
> > everything works fine
> >
> > when I use apache in 'Apache-Tomcat Smart Context Redirection' as in
> described
> > in
> >
> http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/tomcat-apache-howto.
> html
> >
> > struts will not handle the requests in the form :
> > http://foo.com/foo/something.do
> > but reply instead "Error:400 Invalid Path was requested"
> >
> > Debbuging the code for ActionServlet
> > I see that request.getPathInfo()
> > returns null when called directly by tomcat
> > and "" when called through Apache
> >
> > so the following test in ActionServlet (#1252)
> > > // For prefix matching, we want to match on the path info (if any)
> > > path = request.getPathInfo();
> > > if (path != null)
> > >     return (path);
> > returns an empty path, thus the error.
> >
> > shouldn't this code be:
> > > // For prefix matching, we want to match on the path info (if any)
> > > path = request.getPathInfo();
> > >(+) if (path != null && 0<path.length())
> > >     return (path);
> >
> > or am I mistaking something in my Apache-Tomcat Smart Context Redirection
> > configuration ?
> >
> > Christophe
> >

Mime
View raw message