Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 33620 invoked from network); 21 Jul 2000 00:33:22 -0000 Received: from lukla.sun.com (192.18.98.31) by locus.apache.org with SMTP; 21 Jul 2000 00:33:22 -0000 Received: from centralmail1.Central.Sun.COM ([129.147.62.10]) by lukla.Sun.COM (8.9.3+Sun/8.9.3) with ESMTP id SAA21905 for ; Thu, 20 Jul 2000 18:33:21 -0600 (MDT) Received: from esun1as-mm. (esun1as-mm.Central.Sun.COM [129.147.34.144]) by centralmail1.Central.Sun.COM (8.9.3+Sun/8.9.3/ENSMAIL,v1.7) with SMTP id SAA20715 for ; Thu, 20 Jul 2000 18:33:19 -0600 (MDT) Received: from eng.sun.com by esun1as-mm. (SMI-8.6/SMI-SVR4) id SAA28740; Thu, 20 Jul 2000 18:35:16 -0600 Message-ID: <39779A6B.41F14B4E@eng.sun.com> Date: Thu, 20 Jul 2000 17:33:47 -0700 From: "Craig R. McClanahan" X-Mailer: Mozilla 4.72 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: tomcat-dev@jakarta.apache.org Subject: Re: Can you get the webapp context path from the javax.servlet API? References: <00072016283702.09428@murphy> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Is something wrong with request.getContextPath() for this? It's part of the standard servlet 2.2 API. Craig Michael Taylor wrote: > I had some really big problems with the implementation of jsp:include failing > from a JSP to a servlet, so I wrote my own include tag. > > I need to know if there is a way to get the context path from without creating > a dependency on tomcat. If my web-app context is /foo and I want to convert a > URL relative to the current context back into an external URL with the full > syntax, then I have to make the following call at this point: > > ((org.apache.tomcat.core.ServletContextFacade)pageContext.getServletContext()).getRealContext().getPath(); > > I also think I ocould do it with > > ((org.apache.tomcat.core.HttpServletRequestFacade)RequestpageContext.getRequest()).getRealRequest().getContext().getPath(); > > It seems to me that this is a simple enough thing to get the /foo portion of > the path back out of the Servlet engine, but I can't find this anywhere. > > Thanks for the help, > > Mike Taylor > mdt@qad.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org