User: reverbel
  Date: 02/03/10 17:23:06

  Modified:    src/main/org/jboss/web WebServer.java
  Log:
  WebServer now handles WebClassLoader subclasses with bytecode generation
  ability (by calling WebClassLoader getBytes method).
  
  Revision  Changes    Path
  1.18      +23 -12    jboss/src/main/org/jboss/web/WebServer.java
  
  Index: WebServer.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/web/WebServer.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- WebServer.java    5 Jan 2002 12:08:54 -0000       1.17
  +++ WebServer.java    11 Mar 2002 01:23:06 -0000      1.18
  @@ -38,7 +38,7 @@
    *
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
  - *   @version $Revision: 1.17 $
  + *   @version $Revision: 1.18 $
    *
    *   Revisions:
    *   
  @@ -49,7 +49,7 @@
         amd downloadServerClasses is true
    */
   public class WebServer
  -     implements Runnable
  +        implements Runnable
   {
      // Constants -----------------------------------------------------
   
  @@ -196,7 +196,9 @@
       */
       public URL addClassLoader(ClassLoader cl)
       {
  -        String key = getClassLoaderKey(cl);
  +        String key = (cl instanceof WebClassLoader) ?
  +                                     ((WebClassLoader)cl).getKey() : 
  +                                     getClassLoaderKey(cl);
           loaderMap.put(key, cl);
           URL loaderURL = null;
           String codebase = System.getProperty("java.rmi.server.codebase");
  @@ -293,15 +295,24 @@
                       Class clazz = loader.loadClass(className);
                       URL clazzUrl = 
clazz.getProtectionDomain().getCodeSource().getLocation();
                       log.trace("clazzUrl = "+clazzUrl);
  -                    if (clazzUrl.getFile().endsWith(".jar"))
  -                       clazzUrl = new URL("jar:"+clazzUrl+"!/"+filePath);
  -                    else
  -                       clazzUrl = new URL(clazzUrl, filePath);
  -                    if (clazzUrl == null)
  -                     throw new Exception("Class not found:"+className);
  -              
  -                    // Retrieve bytecodes
  -                    bytes = getBytes(clazzUrl);
  +                    if (clazzUrl == null) 
  +                    {
  +                        // Does the WebClassLoader of clazz 
  +                        // have the ability to obtain the bytecodes of clazz?
  +                        bytes = 
((WebClassLoader)clazz.getClassLoader()).getBytes(clazz);
  +                        if (bytes == null)
  +                            throw new Exception("Class not found: " + className);
  +                    }
  +                    else 
  +                    {
  +                        if (clazzUrl.getFile().endsWith(".jar"))
  +                            clazzUrl = new URL("jar:"+clazzUrl+"!/"+filePath);
  +                        else
  +                            clazzUrl = new URL(clazzUrl, filePath);
  +                        
  +                        // Retrieve bytecodes
  +                        bytes = getBytes(clazzUrl);
  +                    }
                   }
                   else if( loader != null && filePath.length() > 0 && 
downloadServerClasses )
                   {
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to