User: starksm 
  Date: 01/07/03 01:04:21

  Modified:    src/main/org/jboss/web Tag: Branch_2_4 WebServer.java
                        WebServiceMBean.java
  Log:
  Remove the restart logic on error from accept and only log the
  error if the server socket is not null. This avois the shutdown
  problem currently seen.
  
  Restore ability to download from the server classpath if no loader key is found
  amd downloadServerClasses is true.
  
  Added downloadServerClasses attribute to WebServiceMBean
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.4.2   +31 -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.5.4.1
  retrieving revision 1.5.4.2
  diff -u -r1.5.4.1 -r1.5.4.2
  --- WebServer.java    2001/06/19 03:34:57     1.5.4.1
  +++ WebServer.java    2001/07/03 08:04:20     1.5.4.2
  @@ -34,7 +34,7 @@
    *
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
  - *   @version $Revision: 1.5.4.1 $
  + *   @version $Revision: 1.5.4.2 $
    *
    *   Revisions:
    *   
  @@ -52,6 +52,11 @@
       private HashMap loaderMap = new HashMap();
       /** The web server http listening socket */
       private ServerSocket server = null;
  +    /** A flag indicating if the server should attempt to download classes from
  +     thread context class loader when a request arrives that does not have a
  +     class loader key prefix.
  +    */
  +    private boolean downloadServerClasses = true;
   
       /** The class wide mapping of type suffixes(class, txt) to their mime
        type string used as the Content-Type header for the vended classes/resources */
  @@ -74,6 +79,15 @@
           return port; 
       }
   
  +   public boolean getDownloadServerClasses()
  +   {
  +      return downloadServerClasses;
  +   }
  +   public void setDownloadServerClasses(boolean flag)
  +   {
  +      downloadServerClasses = flag;
  +   }
  +
       /** Augment the type suffix to mime type mappings
        @param extension, the type extension without a
           period(class, txt)
  @@ -180,18 +194,11 @@
           }
           catch (IOException e) 
           {
  -            // This restart logic seems questionable...
  -            debug("DynaServer stopped: " + e.getMessage());
  -            e.printStackTrace();
  -            debug("Restarting DynaServer");
  -            try
  -            {
  -                start();
  -            } catch (IOException ex)
  -            {
  -                debug("Restart failed");
  -            }
  +            // If the server is not null meaning we were not stopped report the err
  +            if( server != null )
  +               debug("DynaServer error: " + e.getMessage());
               return;
  +
           }
   
           // Create a new thread to accept the next connection
  @@ -213,6 +220,18 @@
                   trace("WebServer: loaderKey = "+loaderKey);
                   trace("WebServer: filePath = "+filePath);
                   ClassLoader loader = (ClassLoader) loaderMap.get(loaderKey);
  +                /* If we did not find a class loader check to see if the raw path
  +                 begins with className + '@' + cl.hashCode() + '/' by looking for
  +                 an '@' char. If it does not and downloadServerClasses is true use
  +                 the thread context class loader and set filePath to the rawPath
  +                */
  +                if( loader == null && rawPath.indexOf('@') < 0 )
  +                {
  +                   filePath = rawPath;
  +                   trace("No loader, reset filePath = "+filePath);
  +                   loader = Thread.currentThread().getContextClassLoader();
  +                }
  +
                   trace("WebServer: loader = "+loader);
                   byte[] bytes;
                   if( filePath.endsWith(".class") )
  
  
  
  1.3.4.1   +8 -2      jboss/src/main/org/jboss/web/WebServiceMBean.java
  
  Index: WebServiceMBean.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/web/WebServiceMBean.java,v
  retrieving revision 1.3
  retrieving revision 1.3.4.1
  diff -u -r1.3 -r1.3.4.1
  --- WebServiceMBean.java      2001/06/09 19:33:39     1.3
  +++ WebServiceMBean.java      2001/07/03 08:04:20     1.3.4.1
  @@ -14,7 +14,7 @@
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
    *   @author [EMAIL PROTECTED]
  - *   @version $Revision: 1.3 $
  + *   @version $Revision: 1.3.4.1 $
    */
   public interface WebServiceMBean
      extends org.jboss.util.ServiceMBean
  @@ -27,7 +27,13 @@
      
      public void removeClassLoader(ClassLoader cl);
   
  -     public void setPort(int port);
  +   public void setPort(int port);
        
      public int getPort();
  +   /** A flag indicating if the server should attempt to download classes from
  +    thread context class loader when a request arrives that does not have a
  +    class loader key prefix.
  +    */
  +   public boolean getDownloadServerClasses();
  +   public void setDownloadServerClasses(boolean flag);
   }
  
  
  

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

Reply via email to