ClassLoader

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
 
Line 12: Line 12:
 
  <%@ page import="com.caucho.loader.*, java.util.*" %>
 
  <%@ page import="com.caucho.loader.*, java.util.*" %>
 
   
 
   
  <ol>
+
  &lt;ol>
 
  <%
 
  <%
 
   LinkedList loaders = new LinkedList();
 
   LinkedList loaders = new LinkedList();
Line 28: Line 28:
 
     loader  = (ClassLoader) iter.next();
 
     loader  = (ClassLoader) iter.next();
 
   
 
   
     out.print("<li>");
+
     out.print("&lt;li>");
 
     out.println(loader.toString());
 
     out.println(loader.toString());
 
   
 
   
 
     if (loader instanceof DynamicClassLoader) {
 
     if (loader instanceof DynamicClassLoader) {
       out.print("<ul>");
+
       out.print("&lt;ul>");
 
   
 
   
 
       DynamicClassLoader dynamicClassLoader = (DynamicClassLoader) loader;
 
       DynamicClassLoader dynamicClassLoader = (DynamicClassLoader) loader;
Line 39: Line 39:
 
       String pathSeparator = "" + java.io.File.pathSeparatorChar;
 
       String pathSeparator = "" + java.io.File.pathSeparatorChar;
 
   
 
   
       classPath = "<li>" + classPath.replace(pathSeparator, "\n<li>");
+
       classPath = "&lt;li>" + classPath.replace(pathSeparator, "\n&lt;/li>");
 
       out.println(classPath);  
 
       out.println(classPath);  
 
   
 
   
       out.print("</ul>");
+
       out.print("&lt;/ul>");
 
     }
 
     }
 
   }
 
   }
 
  %>
 
  %>
 
  </ol>
 
  </ol>

Revision as of 21:27, 16 November 2005


See Also

class-loader describes ClassLoader configuration

Show the classpath/classloaders for the web-app

The following jsp will reveal the classpath that is in effect for your web-app (but not if you are using the servlet-hack):

<%@ page import="com.caucho.loader.*, java.util.*" %>

<ol>
<%
  LinkedList loaders = new LinkedList();

  ClassLoader loader = Thread.currentThread().getContextClassLoader();

  while (loader != null) {
    loaders.addFirst(loader);
    loader = loader.getParent();
  }

  Iterator iter = loaders.iterator();

  while (iter.hasNext()) {
    loader  = (ClassLoader) iter.next();

    out.print("<li>");
    out.println(loader.toString());

    if (loader instanceof DynamicClassLoader) {
      out.print("<ul>");

      DynamicClassLoader dynamicClassLoader = (DynamicClassLoader) loader;

      String classPath = dynamicClassLoader.getLocalClassPath();
      String pathSeparator = "" + java.io.File.pathSeparatorChar;

      classPath = "<li>" + classPath.replace(pathSeparator, "\n</li>");
      out.println(classPath); 

      out.print("</ul>");
    }
  }
%>
</ol>
Personal tools