The following code will take care of your troubles. It was
explained to me recently that URL patterns to servlets like "/*" are
actually inccorret. They mask *.jsp and other possible extentions.
You should, when you have to, map a servlet to a path ending with
"/". But pathInfo disappears then. The following code should
handle BOTH mappings for you:
String servletPath = req.getServletPath();
String pathInfo = req.getPathInfo();
if (pathInfo == null) {
pathInfo = servletPath;
}
servletPath has the same data as pathInfo when a servlet is mapped
to "/".
Giver a try.
> --- Marc Saegesser <[EMAIL PROTECTED]> wrote:
> > I tested this in 3.2.2b1 using the SnoopServlet that comes with
> the
> > examples
> > web app and it seems to work fine.
> >
> > To test test it yourself you'll need to make a small modification
> > to
> > examples/web-inf/web.xml. Change the url-pattern for snoop to be
> > /snoop/*
> > instead of /snoop. Then you can try the following URLs and see
> if
> > the
> > pathinfo appears correctly in both cases.
> >
> > http://localhost:8080/examples/servlet/SnoopServlet/pathinfo
> >
> > and
> >
> > http://localhost:8080/examples/snoop/pathinfo
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, March 02, 2001 6:45 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: getPathInfo() returns null
> > >
> > >
> > > "Craig R. McClanahan" wrote:
> > > >
> > > > Vladimir Grishchenko wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I'm new to Tomcat and servlets and need some help.
> > > > > Would somebody clarify why getPathInfo() returns null when
> a
> > > servlet accessed via:
> > > > >
> > > > > http://server/context/servletalias/pathinfo
> > > > >
> > > > > and it returns "pathinfo" when the same servlet accesses
> via:
> > > > >
> > > >
> > > > It actually returns "/pathinfo", right?
> > >
> > > yes
> > >
> > > >
> > > > >
> > > > > http://server/context/servlet/servletalias/pathinfo
> > > > >
> > > > > Both invocatoin options seem to work (except the Pathinfo
> > > part), which is the "correct"
> > > > > way to call servlets? What is the difference?
> > > > >
> > > >
> > > > What version of Tomcat does this? You are correct -- you
> > > should be able to retrieve the
> > > > path info in either case.
> > >
> > > 3.2.1
> > > Could my configuration be messed up???
> > >
> > > >
> > > > >
> > > > > Thanx,
> > > > > Vlad.
> > > > >
> > > >
> > > > Craig McClanahan
> > > >
> > > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > > For additional commands, email:
> > [EMAIL PROTECTED]
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > For additional commands, email:
> > [EMAIL PROTECTED]
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, email:
> [EMAIL PROTECTED]
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]