users@glassfish.java.net

getServletContextName always returns empty string?

From: <glassfish_at_javadesktop.org>
Date: Wed, 10 Oct 2007 23:30:44 PDT

I have a ServletContextListener and as a test I have the servletContextName retrieved on contextInitialized like the following.

public void contextInitialized( ServletContextEvent servletContextEvent )
   {
      String servletContextName = servletContextEvent.getServletContext().getServletContextName();
   }

The problem is the servletContextName is always empty even if I define the display-name property in the web.xml like the following.

<servlet>
      <display-name>First Servlet</display-name>
       ...
 </servlet>
<servlet>
      <display-name>Second Servlet</display-name>
       ...
 </servlet>

I see my contextInitialized hit twice but yet the names are empty. I need to determine when one particular servlet has been initialized.

Thanks, S.D.
[Message sent by forum member 'samdoyle' (samdoyle)]

http://forums.java.net/jive/thread.jspa?messageID=239442