RE: How to get the context path for a web application?
Hi, getServletContextName requires that you define it in your web.xml, and doesn't need to correspond to the path attribute of the Context element, so don't count on that. Yoav Shapira Millennium Research Informatics -Original Message- From: Dov Rosenberg [mailto:[EMAIL PROTECTED] Sent: Monday, August 09, 2004 10:49 PM To: Tomcat Users List Subject: How to get the context path for a web application? I need to find a way to get the context path of the current web application. I would like to to it using the HttpSession, HttpServletRequest or response. I tried the ServletContext.getServletContextName but it returns null in Tomcat. Is there a cross container solution? -- Dov Rosenberg Conviveon Corporation http://www.conviveon.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to get the context path for a web application?
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:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the context path for a web application?
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. But do any of those return the context path? I didn't see it anywhere in the javadocs. David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to get the context path for a web application?
Have you tried ? request.getServletPath(); Keith -Original Message- From: Dov Rosenberg [mailto:[EMAIL PROTECTED] Sent: Monday, August 09, 2004 9:49 PM To: Tomcat Users List Subject: How to get the context path for a web application? I need to find a way to get the context path of the current web application. I would like to to it using the HttpSession, HttpServletRequest or response. I tried the ServletContext.getServletContextName but it returns null in Tomcat. Is there a cross container solution? -- Dov Rosenberg Conviveon Corporation http://www.conviveon.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to get the context path for a web application?
also, request.getContextPath(); aris -Original Message- From: Keith Bottner [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 10, 2004 12:10 PM To: 'Tomcat Users List' Subject: RE: How to get the context path for a web application? Have you tried ? request.getServletPath(); Keith -Original Message- From: Dov Rosenberg [mailto:[EMAIL PROTECTED] Sent: Monday, August 09, 2004 9:49 PM To: Tomcat Users List Subject: How to get the context path for a web application? I need to find a way to get the context path of the current web application. I would like to to it using the HttpSession, HttpServletRequest or response. I tried the ServletContext.getServletContextName but it returns null in Tomcat. Is there a cross container solution? -- Dov Rosenberg Conviveon Corporation http://www.conviveon.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]