Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 45085 invoked from network); 10 Aug 2004 16:24:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 10 Aug 2004 16:24:13 -0000 Received: (qmail 8570 invoked by uid 500); 10 Aug 2004 16:23:33 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 8486 invoked by uid 500); 10 Aug 2004 16:23:32 -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 8393 invoked by uid 99); 10 Aug 2004 16:23:30 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [206.163.82.97] (HELO integraonline.com) (206.163.82.97) by apache.org (qpsmtpd/0.27.1) with SMTP; Tue, 10 Aug 2004 09:23:27 -0700 Received: (qmail 13011 invoked from network); 10 Aug 2004 16:22:47 -0000 Received: from unknown (HELO RESEARCH2) (?pbs?robert.iat-cti.com@208.46.68.194) by 0 with SMTP; 10 Aug 2004 16:22:47 -0000 Reply-To: From: "Robert Harper" To: "'Tomcat Users List'" , "'David Wall'" Subject: RE: How to get the context path for a web application? Date: Tue, 10 Aug 2004 10:24:10 -0600 Message-ID: <000301c47ef6$78abdc00$297ba8c0@RD.IATCTI.COM> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 In-Reply-To: <129b01c47ef4$c3e4d390$3201a8c0@rasta> Importance: Normal X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N A ServletConfig reference is passed in the call to the init() method of your servlet. From this you may use the getServletContext() method to get the context. One thing to remember is that this does not get called until the servlet is initialized and would be invalidated when it is destroyed. I suggest you check the API docs for more information. Robert S. Harper 801.265.8800 ex. 255 > -----Original Message----- > From: David Wall [mailto:d.wall@computer.org] > Sent: Tuesday, August 10, 2004 10:07 AM > To: Tomcat Users List > Subject: Re: How to get the context path for a web application? > > > request.getContextPath(); > > Is there a way to do it when not serving a web page? Like in a startup > servlet that has a ServletConfig/Context, but doesn't have a request? This > way, the context could be retrieved once and cached and used in situations > unrelated to processing a specific HTTP request. > > David > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org