On 3/29/2010 12:22 PM, David kerber wrote:
On 3/29/2010 12:05 PM, Caldarale, Charles R wrote:
From: David kerber [mailto:dcker...@verizon.net]
Subject: Get context path in tc 5.5

In TC 5.5.28, Java 5, how can I find the context path that was called,
so I can log it?

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 I log a new session in
HttpSessionListener.sessionCreated() event? I'm drawing blanks right and
left in my searching for this.

After some experimentation, I found that Context.getResource( "/" ) gives me what I want: I get something like "jndi:/localhost/SiteData/". All I really wanted is the "/SiteData" part, but this is close enough for my logs' purposes.

D

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

Reply via email to