On 3/29/2010 12:55 PM, Hassan Schroeder wrote:
On Mon, Mar 29, 2010 at 9:22 AM, David kerber<dcker...@verizon.net>  wrote:

HttpServletRequest.getContextPath()

  - Chuck

Thanks; that will work once they get into my app's functionality.  Is there
anything I can use to get the context path when they first connect

When they "first connect" it's via a request -- so you have what you
need to get that context path, by definition.


Yes, I finally figured it out, though it's kind of round-about; in the SessionCreated event of my HttpSessionListener, I use:

   HttpSession session = event.getSession();
   ServletContext context = session.getServletContext();
   String contextPath = context.getResource( "/" ).toString();

As Chuck pointed out, the long-term answer is to switch to Servlet API 2.5, as implemented in TC 6, but this will do for now.

D

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to