>
> There are two getRequestDispatcher() methods.
> One in the ServletContext that uses absolute paths (start with /).
> One in the request that uses relative paths.
> Looks like you need the absolute path one.
No. My understanding is that the one in ServletContext takes paths relative to
the context root. _Not_ absolute paths.
To recap ..
I have a URI which I need to forward to the correct ServletContext. I can
do something like:
ServletContext other = getServletContext().getContext(uri);
This works because getContext() takes absolute paths.
But then how to I call getRequestDispatcher or getRealPath on that other
context? To get the correct result I need to strip off the other contexts root
from the URI before callign getRequestDispatcher or getRealPath. But I can't
find any way of determining what the root of the other context is. It could
just be the default "/" context or it could be a context which handles the URL
explicitly.
Help, anyone?
Richard
>
> --- Richard Evans <[EMAIL PROTECTED]> wrote:
> > But I need the context path for a different ServletContext.
> > request.getContextPath returns the path for _this_ context, not a
> > foreign
> > one.
> >
> > > -----Original Message-----
> > > From: Wyn Easton [mailto:[EMAIL PROTECTED]]
> > > Sent: 11 November 2000 21:57
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: Contexts and dispatchers
> > >
> > >
> > > --- Richard Evans <[EMAIL PROTECTED]> wrote:
> > > > "/file/x/y". (The URL without the context root). How to I find
> > the
> > > > context
> > >
> > > Use request.getContextPath()
> > >
> > > If your web app. is called app1 getContextPath() would return /app1
> > >
> > >
> > >
> > >
> > > =====
> > > Wyn Easton
> > > [EMAIL PROTECTED]
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Calendar - Get organized for the holidays!
> > > http://calendar.yahoo.com/
> >
>
>
> =====
> Wyn Easton
> [EMAIL PROTECTED]
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Calendar - Get organized for the holidays!
> http://calendar.yahoo.com/
>