Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 38035 invoked by uid 500); 1 Apr 2001 14:45:36 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 38028 invoked from network); 1 Apr 2001 14:45:35 -0000 Received: from staff1.cso.uiuc.edu (root@128.174.5.59) by h31.sny.collab.net with SMTP; 1 Apr 2001 14:45:35 -0000 Received: from localhost (mepstein@localhost [127.0.0.1]) by staff1.cso.uiuc.edu (8.11.0/8.11.0) with ESMTP id f31EjZt07067 for ; Sun, 1 Apr 2001 09:45:35 -0500 (CDT) Date: Sun, 1 Apr 2001 09:45:35 -0500 (CDT) From: Milt Epstein X-Sender: mepstein@staff1.cso.uiuc.edu To: tomcat-user@jakarta.apache.org Subject: Re: getServletNames()? In-Reply-To: <001001c0ba79$270ebba0$b7ccb1c2@oop> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N On Sun, 1 Apr 2001, George Kakarontzas wrote: > Hi all. > I have been trying to make this run: > ==================================== > import javax.servlet.http.*; > > public class Loaded extends HttpServlet { > > public void doGet(HttpServletRequest req, HttpServletResponse res) > throws ServletException, IOException { > res.setContentType("text/plain"); > PrintWriter out = res.getWriter(); > ServletContext context = getServletContext(); > Enumeration names = context.getServletNames(); > while (names.hasMoreElements()) { > String name = (String)names.nextElement(); > Servlet servlet = context.getServlet(name); > out.println("Servlet name: " + name); > out.println("Servlet class: " + servlet.getClass().getName()); > out.println("Servlet info: " + servlet.getServletInfo()); > out.println(); > } > } > } > ======================================== > However the Enumeration returned by context.getServletNames() is empty! > It is supposed to return the serlvets loaded (including Loaded itself). > I know that this method has been deprecated in jdk1.3, which I'm > using, but it should work anyway. > Any suggestions? Why do you think it should work even if it's been deprecated? This method was deprecated long ago, in JSDK Spec 2.1, and doesn't do anything anymore (like it's related method, getServlet()). Milt Epstein Research Programmer Software/Systems Development Group Computing and Communications Services Office (CCSO) University of Illinois at Urbana-Champaign (UIUC) mepstein@uiuc.edu