getServletNames() - Method in interface
javax.servlet.ServletContext
Deprecated. As of Java Servlet API 2.1, with no replacement.
This method was originally defined to return an Enumeration of all the servlet names known to this context. In this version, this method always returns an empty Enumeration and remains only to preserve binary compatibility. This method will be permanently removed in a future version of the Java Servlet API.
Deprecated. As of Java Servlet API 2.1, with no replacement.
This method was originally defined to return an Enumeration of all the servlet names known to this context. In this version, this method always returns an empty Enumeration and remains only to preserve binary compatibility. This method will be permanently removed in a future version of the Java Servlet API.
That's why :-(
----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
Hopefully I making some simple, stupid mistake that someone
will recognize right away, but I can't make this code work:
ServletContext zone = getServletConfig().getServletContext()
Enumeration names = zone.getServletNames();
while (names.hasMoreElements()) {
out.println(zone.getServlet((String)names.nextElement()).getServletInfo out.println(zone.getServlet((String)names.nextElement()).getServletInfo());
}
getServletNames() returns nothing (that is, the while loop is
never executed). On the other hand, if I replace the while
loop with this:
out.println(zone.getServlet("AValidServletName").getServletInfo());
I get the servlet info I'm looking for.
Can anyone explain why getServletNames() isn't working for me?
Also, in the JSDK 2.0 docs (and its copied in the JServ docs for
the JServContext class), it says this about getServletNames():
Note: This is a dangerous method to call for the following reasons.
When this method is called the state of the servlet may not
be known, and this could cause problems with the server's
servlet state machine.
[...]
Can anyone explain if this is a real danger in JServ, and if so
are there any circumstances under which it is a safe call? All
I'm really trying to do is write a monitoring agent servlet that
will list information about each servlet that is currently loaded.
Is there a safe way to do that?
Thanks,
-Don
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]om
To unsubscribe: [EMAIL PROTECTED]com
Search Archives: <http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]
--
Simu Soft
Simu Soft
Anders Svensson
Nørrebrogade 140, 4 th
2200 København N
e-mail :
[EMAIL PROTECTED]
tlf. :
+45 3583 8126