Servlet spec 2.4 doesn't know context path and initialization time???

K

Kimba

Hi everyone,

I have the following problem:

My web application is loading a Servlet on start-up. This servlet
initializes the web-application's environment inside the
init(ServletConfig config) method. Now, at this point in time I'd like
to dynamically get the web-app's context path. Unfortunately the
ServletContext doesn't have the getContextPath() method in servlet
specification 2.4 only in 2.5. And since the init(...) method doesn't
have a HttpServletRequest I have no chance of retrieving the servlet's
context path at initialization time??

Any suggestions on that??

Thanks,

Steffen
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Kimba said:
My web application is loading a Servlet on start-up. This servlet
initializes the web-application's environment inside the
init(ServletConfig config) method. Now, at this point in time I'd like
to dynamically get the web-app's context path. Unfortunately the
ServletContext doesn't have the getContextPath() method in servlet
specification 2.4 only in 2.5. And since the init(...) method doesn't
have a HttpServletRequest I have no chance of retrieving the servlet's
context path at initialization time??

Any suggestions on that??

ctx.getServletContextName()

or

ctx.getRealPath("/")

maybe.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top