Re: Get context path in tc 5.5
On 3/29/2010 12:55 PM, Hassan Schroeder wrote: On Mon, Mar 29, 2010 at 9:22 AM, David kerber 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
Re: Get context path in tc 5.5
On 3/29/2010 12:58 PM, Caldarale, Charles R wrote: From: David kerber [mailto:dcker...@verizon.net] Subject: Re: Get context path in tc 5.5 Is there anything I can use to get the context path when they first connect Move to Tomcat 6, so you can use the 2.5 servlet APIs. I'm working toward that goal... D - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Get context path in tc 5.5
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
RE: Get context path in tc 5.5
> From: David kerber [mailto:dcker...@verizon.net] > Subject: Re: Get context path in tc 5.5 > > Is there anything I can use to get the context path when they > first connect Move to Tomcat 6, so you can use the 2.5 servlet APIs. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Get context path in tc 5.5
On Mon, Mar 29, 2010 at 9:22 AM, David kerber 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. -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Get context path in tc 5.5
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. Dave - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Get context path in tc 5.5
> 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 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org