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

Discussion in 'Java' started by Kimba, Mar 28, 2007.

  1. Kimba

    Kimba Guest

    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
     
    Kimba, Mar 28, 2007
    #1
    1. Advertising

  2. Re: Servlet spec 2.4 doesn't know context path and initializationtime???

    Kimba wrote:
    > 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
     
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Mar 29, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. circuit_breaker
    Replies:
    2
    Views:
    2,052
    Jack Jia
    Apr 4, 2004
  2. Andrew Purser
    Replies:
    3
    Views:
    5,140
    Alex Kay
    Nov 4, 2004
  3. Replies:
    3
    Views:
    29,263
    Stuart Wood
    Jun 6, 2006
  4. Replies:
    4
    Views:
    706
    santax
    Apr 20, 2007
  5. Andrew Chen
    Replies:
    1
    Views:
    208
    David Chelimsky
    Mar 25, 2008
Loading...

Share This Page