tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java
Date Fri, 24 May 2002 17:41:48 GMT
remm        02/05/24 10:41:48

  Modified:    catalina/src/share/org/apache/catalina/servlets
                        ManagerServlet.java
  Log:
  - Handle resources nested in subcontexts.
  
  Revision  Changes    Path
  1.22      +34 -15    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ManagerServlet.java	21 May 2002 01:36:36 -0000	1.21
  +++ ManagerServlet.java	24 May 2002 17:41:48 -0000	1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
1.21 2002/05/21 01:36:36 remm Exp $
  - * $Revision: 1.21 $
  - * $Date: 2002/05/21 01:36:36 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
1.22 2002/05/24 17:41:48 remm Exp $
  + * $Revision: 1.22 $
  + * $Date: 2002/05/24 17:41:48 $
    *
    * ====================================================================
    *
  @@ -76,8 +76,8 @@
   import java.util.Iterator;
   import java.util.jar.JarEntry;
   import java.util.jar.JarFile;
  +import javax.naming.Binding;
   import javax.naming.InitialContext;
  -import javax.naming.NameClassPair;
   import javax.naming.NamingEnumeration;
   import javax.naming.NamingException;
   import javax.naming.directory.DirContext;
  @@ -198,7 +198,7 @@
    * </ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.21 $ $Date: 2002/05/21 01:36:36 $
  + * @version $Revision: 1.22 $ $Date: 2002/05/24 17:41:48 $
    */
   
   public class ManagerServlet
  @@ -804,19 +804,38 @@
           } else {
               writer.println(sm.getString("managerServlet.resourcesAll"));
           }
  +
  +        printResources(writer, "", global, type);
  +
  +    }
  +
  +
  +    /**
  +     * List the resources of the given context.
  +     */
  +    protected void printResources(PrintWriter writer, String prefix,
  +                                  javax.naming.Context namingContext,
  +                                  String type) {
  +
           try {
  -            NamingEnumeration items = global.list("");
  +            NamingEnumeration items = namingContext.listBindings("");
               while (items.hasMore()) {
  -                NameClassPair item = (NameClassPair) items.next();
  -                if ((type != null) &&
  -                    (!type.equals(item.getClassName()))) {
  -                    continue;
  +                Binding item = (Binding) items.next();
  +                if (item.getObject() instanceof javax.naming.Context) {
  +                    printResources
  +                        (writer, prefix + item.getName() + "/",
  +                         (javax.naming.Context) item.getObject(), type);
  +                } else {
  +                    if ((type != null) &&
  +                        (!type.equals(item.getClassName()))) {
  +                        continue;
  +                    }
  +                    writer.print(prefix + item.getName());
  +                    writer.print(':');
  +                    writer.print(item.getClassName());
  +                    // Do we want a description if available?
  +                    writer.println();
                   }
  -                writer.print(item.getName());
  -                writer.print(':');
  -                writer.print(item.getClassName());
  -                // Do we want a description if available?
  -                writer.println();
               }
           } catch (Throwable t) {
               log("ManagerServlet.resources[" + type + "]", t);
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message