You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by peter lin <pe...@labs.gte.com> on 2002/07/22 14:39:42 UTC

webapp

Does anyone know how to get the webapp name from ServletContext?  Here
is a quick description of what i am trying to do.

I have a webapp that i want to load when tomcat starts. I want to make
sure the webapp only starts for one webapp and not the others.

I wrote a test class that implements
javax.servlet.ServletContextListener. What I'm seeing is the event is
fired twice and therefore loading the app twice.  It seems a bit weird
to have the event fire twice.  My test Listener checks to make sure the
app isn't already in the ServletContext before creating it.  I have the
root path set to specific path in server.xml.

thanks in advance.


peter lin

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: webapp

Posted by peter lin <pe...@labs.gte.com>.
I figured out why I was getting null back from
SERVLETCONTEXT.getServletContextName(), my web.xml file didn't have the
<display-name>name</display-name> defined. Now that I have it in there,
I see the event fired twice for my webapp.

Is that a bug? From what I can tell, it is creating the webapp twice. 
If I print out event.getSource() the objects are different.  Can someone
verify if this is a bug?


peter lin


peter lin wrote:
> 
> Does anyone know how to get the webapp name from ServletContext?  Here
> is a quick description of what i am trying to do.
> 
> I have a webapp that i want to load when tomcat starts. I want to make
> sure the webapp only starts for one webapp and not the others.
> 
> I wrote a test class that implements
> javax.servlet.ServletContextListener. What I'm seeing is the event is
> fired twice and therefore loading the app twice.  It seems a bit weird
> to have the event fire twice.  My test Listener checks to make sure the
> app isn't already in the ServletContext before creating it.  I have the
> root path set to specific path in server.xml.
> 
> thanks in advance.
> 
> peter lin
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>