I've concluded that there is no way to do this- how absurd! I can get a context to a uri in another application, but there is no way to dispatch to it because the context won't tell me what its base path is!!
Isn't this a design oversight in the servlet 2.3 api? In other words, why shouldn't I be able to take in a uri, find its corresponding context, and dispatch to it?? Basically this leaves no way to do server-side includes across applications in servlet2.3, which from my understanding is the entire point of the dispatch mechanism in the first place! If I want a chain of servlets processing my request, why shouldn't i be able to specify the servlet by its server-root uri, instead of using two separate parameters (context base and uri)? Any comments? Very frustrating. The only way i can see to do this in tomcat is to override the org.apache.catalina.core.ApplicationContext and ApplicationContextFascade to make a public method getBasePath to return the same variable. Does anyone else agree that this should be part of the next servlet spec? -Richard ----- Original Message ----- From: "Richard Sand" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Tuesday, January 08, 2002 7:43 PM Subject: Re: howto get the context path from a ServletContext? > No because I don't have a Request. In other words, the request object I > have is from the current servlet-context, but when I do > nextContext=currentContext.getContext(nexturi), all I have about this other > context is the context object itself and the server-root-relative URI for > "some" resource somewhere within the new context. > > Thanks! > > -Richard > > ----- Original Message ----- > From: "Mark" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <[EMAIL PROTECTED]> > Sent: Tuesday, January 08, 2002 7:33 PM > Subject: Re: howto get the context path from a ServletContext? > > > > Is getContextPath() possibly what you're looking for? It's found in the > > HttpServletRequest interface. > > > > > > At 07:23 PM 1/8/2002 +0100, you wrote: > > >Is there a way to figure out the context path from a given > ServletContext? > > I'm inside one context and am trying to dispatch to a resource in another > > context based upon the absolute URI (in other words, a uri relative to the > > server root). > > > > > >I can get the proper servlet context as follows: > > > > > >nextContext = thisServletContext.getContext(dispatch_to_this_uri); > > > > > >but then I cannot figure out how to do a dispatch to the uri because I > > don't know how to strip off the context path from the front of the URI! > > > > > >I have a feeling I'm asking a really stupid question, but I'm going blind > > from looking at the servlet 2.3 javadoc for so long! > > > > > >Can anyone help? > > > > > >Thanks! > > > > > >Best regards, > > > > > >Richard > > > > > > > > > -- > > To unsubscribe: <mailto:[EMAIL PROTECTED]> > > For additional commands: <mailto:[EMAIL PROTECTED]> > > Troubles with the list: <mailto:[EMAIL PROTECTED]> > > > > > > > -- > To unsubscribe: <mailto:[EMAIL PROTECTED]> > For additional commands: <mailto:[EMAIL PROTECTED]> > Troubles with the list: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>