Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 45341 invoked from network); 20 Sep 2002 17:41:12 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 20 Sep 2002 17:41:12 -0000 Received: (qmail 17031 invoked by uid 97); 20 Sep 2002 17:41:15 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 16998 invoked by uid 97); 20 Sep 2002 17:41:15 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 16973 invoked by uid 98); 20 Sep 2002 17:41:14 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Subject: Re: Re[2]: Context path To: "Tomcat Users List" X-Mailer: Lotus Notes Release 5.0.7 March 21, 2001 Message-ID: From: rsequeira@transentric.com Date: Fri, 20 Sep 2002 12:40:25 -0500 X-MIMETrack: Serialize by Router on TransSMTP01/Transentric(Release 5.0.10 |March 22, 2002) at 09/20/2002 12:41:25 PM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Since the request object isn't available in the init(), adding an init param with the context name would help. RS "Andreas Probst" cc: 09/20/02 09:12 AM Subject: Re: Re[2]: Context path Please respond to "Tomcat Users List" Thank you RS and Jake, I know there is the possibility of init parameters. Because one has to edit them manually I would prefer another more dynamic way of getting the context path. Isn't there another possibility? Andreas > > Jake, you are correct. Guess I was high on dope, huh :-) But I > suppose one could still use the environment entry technique for > "root" contexts. Thanks > > RS > > > Hello rsequeira, > > I think you are mistaking getServletContext with > getRealPath("/"). The servlet context object is too important to > *ever* return null. It is only file system operations that will > not work when the context is deployed in a .war file. > > Jake > > Thursday, September 19, 2002, 1:29:21 PM, you wrote: > > > rtc> Place an environment entry in the web.xml. This way you can > access this rtc> parameter anywhere, anytime. Don't depend on > getContext or rtc> getServletContext methods. If you had a war > file, a getServletContext rtc> returns null. > > rtc> RS > > > rtc> Hi all, > > rtc> I need to know the context path of my web app. If I have a > > rtc> HttpServletRequest req, I can get > rtc> String contextPath = req.getContextPath(); > > rtc> Now, what can I do within init()? I havn't got a > rtc> HttpServletRequest there. How do I get the context path? > > rtc> Thanks in advance. > > rtc> Andreas > -- To unsubscribe, e-mail: < mailto:tomcat-user-unsubscribe@jakarta.apache.org> For additional commands, e-mail: < mailto:tomcat-user-help@jakarta.apache.org> -- To unsubscribe, e-mail: For additional commands, e-mail: