tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Kakarontzas" <gka...@inf.uth.gr>
Subject Re: getServletNames()?
Date Sun, 01 Apr 2001 16:46:44 GMT
OK Milt thanks.
I should read the spec before I ask. It clearly says:
"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"

Cheers!

----- Original Message -----
From: "Milt Epstein" <mepstein@uiuc.edu>
To: <tomcat-user@jakarta.apache.org>
Sent: Sunday, April 01, 2001 5:45 PM
Subject: Re: getServletNames()?


> 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
>


Mime
View raw message