Alex Rivera | Logout

getContextPath using servlet

Asked 2010-03-10T15:10:05.083
11

Context path in jboss-web.xml is mentioned as /Test, but my war file name is Test-0.0.1. I need this war file name using HttpServlet. Please tell me the function name. i tried getContextPath(), but it returns Test. Thanks

Edit
Report

1 Answer

1

From the Servlet API there is no way to access the war file name. The war file name is different from the context root. And , even the ServletContext.getRealPath() is the extract location of the war file, which can be different.

answered 2011-05-20T11:47:31.377

Your Answer