You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrew Cathrow <ac...@seagull.nl> on 2000/05/04 00:57:47 UTC

RE: init() called twice

is init() being called twice because the servlets is failing to initialise
correctly - so is being reloaded.
Try putting a println in the destroy method

-----Original Message-----
From: Tom Oellrich [mailto:toellrich@web.de]
Sent: 26 April 2000 16:27
To: tomcat-user@jakarta.apache.org
Subject: init() called twice


Hello

I have a problem with a servlet's init() method. I have an InitServlet which
is loaded on startup of Tomcat (specified in web.xml). The InitServlet's
init() method basically instantiates a connection pool object and stores it
in the servlet context. I wanted to make sure that no user can call this
InitServlet by typing the URL /foo/servlet/InitServlet in the address field
of his browser. To check this, I included a println("Foo") in the init()
method. Now, my problem is that "Foo" is displayed both during startup of
Tomcat (as it should!) *and* later when I call InitServlet from the address
field of my browser. I thought, a servlet's init() method is only called
once?
While I'm at it, does anybody know how I can protect a specific servlet from
being accessed directly?

TIA
Tom

_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName@web.de, 8MB Speicher, Verschluesselung - http://freemail.web.de


--------------------------------------------------------------------------
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org