User: jules_gosnell
  Date: 02/02/20 18:03:57

  Modified:    jetty/src/main/org/jboss/jetty
                        JBossWebApplicationContext.java Jetty.java
                        JettyService.java
  Log:
  a few more comments in config files
  addition of an FAQ - needs content !
  publish JAAS support via JMX interface
  
  Revision  Changes    Path
  1.27      +15 -36    
contrib/jetty/src/main/org/jboss/jetty/JBossWebApplicationContext.java
  
  Index: JBossWebApplicationContext.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/JBossWebApplicationContext.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- JBossWebApplicationContext.java   20 Feb 2002 05:37:23 -0000      1.26
  +++ JBossWebApplicationContext.java   21 Feb 2002 02:03:57 -0000      1.27
  @@ -5,7 +5,7 @@
    * See terms of license at gnu.org.
    */
   
  -// $Id: JBossWebApplicationContext.java,v 1.26 2002/02/20 05:37:23 janb Exp $
  +// $Id: JBossWebApplicationContext.java,v 1.27 2002/02/21 02:03:57 jules_gosnell 
Exp $
   
   // A Jetty HttpServer with the interface expected by JBoss'
   // J2EEDeployer...
  @@ -40,13 +40,14 @@
     extends WebApplicationContext
   {
     Logger              _log;
  +  Jetty               _jetty;
     WebDescriptorParser _descriptorParser;
     WebApplication      _webApp;
     DocumentBuilder     _parser;
     String              _subjAttrName="j_subject";
   
     public
  -    JBossWebApplicationContext(HttpServer httpServer,
  +    JBossWebApplicationContext(Jetty jetty,
                               String contextPathSpec,
                               WebDescriptorParser descriptorParser,
                               WebApplication webApp,
  @@ -58,10 +59,11 @@
                               String subjAttrName)
       throws java.io.IOException
       {
  -     
  -         super(httpServer, contextPathSpec, warUrl);
  +
  +      super(jetty, contextPathSpec, warUrl);
   
         _log              = Logger.getLogger(getClass().getName()+"#" + 
contextPathSpec);
  +      _jetty            = jetty;
         _descriptorParser = descriptorParser;
         _webApp           = webApp;
         _parser           = parser;
  @@ -164,44 +166,21 @@
       }
   
     String _separator=System.getProperty("path.separator");
  -  protected String
  -    URLArrayToClassPath(URL[] urls, String classpath)
  -    {
  -      for (int i=urls.length-1; urls!=null && i>-1; i--)
  -      {
  -     URL url=urls[i];
  -     if (url.getProtocol().equals("file"))
  -     {
  -       String path=url.getPath();
  -       // brute force - but should strip out duplicates
  -       if (classpath.indexOf(path)==-1)
  -         classpath+=(classpath.length()==0?"":_separator)+path;
  -     }
  -     else
  -       _log.warn("non-file URL encountered in ClassPath URLs");
  -      }
  -
  -      return classpath;
  -    }
   
     public String
       getFileClassPath()
       {
  +      String[] entries=_jetty.getCompileClasspath(getClassLoader());
  +
  +      // this should probably :
  +      // 1. be cached
  +      // 2. use a StringBuffer
         String classpath="";
  -      for (ClassLoader cl=getClassLoader();
  -        cl.getParent()!=null;
  -        cl=cl.getParent())
  -      {
  -     if (cl instanceof URLClassLoader)
  -       classpath=URLArrayToClassPath(((URLClassLoader)cl).getURLs(), classpath);
  -     else if (cl instanceof MBeanClassLoader)
  -       classpath=URLArrayToClassPath(((MBeanClassLoader)cl).getURLs(), classpath);
  -     else
  -       _log.warn("unknown ClassLoader type ("+cl.getClass().getName()+") - 
classpath may be incomplete");
  -      }
  +      for (int i=0; i<entries.length; i++)
  +     
classpath+=(classpath.length()==0?"":_separator)+entries[i].substring("file:".length());
   
  -      if (_log.isDebugEnabled())
  -     _log.debug("JSP classpath: "+classpath);
  +      //      if (_log.isDebugEnabled())
  +     _log.info("JSP classpath: "+classpath);
   
         return classpath;
       }
  
  
  
  1.40      +159 -149  contrib/jetty/src/main/org/jboss/jetty/Jetty.java
  
  Index: Jetty.java
  ===================================================================
  RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/Jetty.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- Jetty.java        20 Feb 2002 05:37:23 -0000      1.39
  +++ Jetty.java        21 Feb 2002 02:03:57 -0000      1.40
  @@ -5,7 +5,7 @@
    * See terms of license at gnu.org.
    */
   
  -// $Id: Jetty.java,v 1.39 2002/02/20 05:37:23 janb Exp $
  +// $Id: Jetty.java,v 1.40 2002/02/21 02:03:57 jules_gosnell Exp $
   
   // A Jetty HttpServer with the interface expected by JBoss'
   // J2EEDeployer...
  @@ -15,21 +15,18 @@
   package org.jboss.jetty;
   
   //------------------------------------------------------------------------------
  +
   import java.io.ByteArrayOutputStream;
   import java.net.URL;
   import java.util.Hashtable;
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
  -
  -import org.w3c.dom.Element;
   import javax.xml.transform.Transformer;
  -import javax.xml.transform.TransformerFactory;
  -import javax.xml.transform.TransformerException;
   import javax.xml.transform.TransformerConfigurationException;
  +import javax.xml.transform.TransformerException;
  +import javax.xml.transform.TransformerFactory;
   import javax.xml.transform.dom.DOMSource;
   import javax.xml.transform.stream.StreamResult;
  -
  -    
   import org.jboss.deployment.DeploymentException;
   import org.jboss.jetty.xml.JettyResolver;
   import org.jboss.logging.Logger;
  @@ -38,6 +35,8 @@
   import org.mortbay.jetty.servlet.WebApplicationContext;
   import org.mortbay.util.MultiException;
   import org.mortbay.xml.XmlConfiguration;
  +import org.w3c.dom.Element;
  +
   //------------------------------------------------------------------------------
   
   /**
  @@ -45,7 +44,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Julian Gosnell</a>
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>.
  - * @version $Revision: 1.39 $
  + * @version $Revision: 1.40 $
    *
    * <p><b>Revisions:</b>
    *
  @@ -61,20 +60,24 @@
   public class Jetty
     extends org.mortbay.jetty.Server
   {
  -  static DocumentBuilderFactory _factory =DocumentBuilderFactory.newInstance();
  +  static DocumentBuilderFactory _factory = DocumentBuilderFactory.newInstance();
  +
     DocumentBuilder               _parser;
     Logger                        _log     = Logger.getLogger(Jetty.class);
  +  JettyService                  _service;
  +
  +  // the XML snippet
  +  String _xmlConfigString = null;
  +
  +  // the XML snippet as a DOM element
  +  Element _configElement = null;
   
  -    // the XML snippet
  -    String _xmlConfigString = null;
  -    
  -    // the XML snippet as a DOM element
  -    Element _configElement = null;
  -    
  -  Jetty()
  +  Jetty(JettyService service)
     {
       super();
   
  +    _service=service;
  +
       // resolver should be populated from a configuration file.
       JettyResolver resolver = new JettyResolver();
   
  @@ -84,12 +87,12 @@
       URL stdWeb23=findResourceInJar("javax/servlet/resources/web-app_2_3.dtd");
       resolver.put("-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN", 
stdWeb23);
   
  -    URL jbossWeb22=findResourceInJar("org/jboss/metadata/jboss-web.dtd");
  -    resolver.put("-//jBoss//DTD Web Application 2.2//EN", jbossWeb22);
  -    resolver.put("-//JBoss//DTD Web Application 2.2//EN", jbossWeb22);
  +    URL jbossWeb2=findResourceInJar("org/jboss/metadata/jboss-web.dtd");
  +    resolver.put("-//jBoss//DTD Web Application 2.2//EN", jbossWeb2);
  +    resolver.put("-//JBoss//DTD Web Application 2.2//EN", jbossWeb2);
   
  -    URL jbossWeb23=findResourceInJar("org/jboss/metadata/jboss-web_3_0.dtd");
  -    resolver.put("-//JBoss//DTD Web Application 2.3//EN", jbossWeb23);
  +    URL jbossWeb3=findResourceInJar("org/jboss/metadata/jboss-web_3_0.dtd");
  +    resolver.put("-//JBoss//DTD Web Application 2.3//EN", jbossWeb3);
   
       try
       {
  @@ -133,35 +136,35 @@
   
     String _webDefault;
   
  -    /** If a webdefault.xml file has been specified in
  -     * jboss-service.xml then we try and use that.
  -     *
  -     * If we cannot find it, then we will use the one
  -     * shipped as standard with Jetty and issue a warning.
  -     * 
  -     * If the jboss-service.xml file does not specify a
  -     * custom one, then we again default to the standard one.
  -     * @param webDefault 
  -     */
  -    public synchronized void
  +  /** If a webdefault.xml file has been specified in
  +   * jboss-service.xml then we try and use that.
  +   *
  +   * If we cannot find it, then we will use the one
  +   * shipped as standard with Jetty and issue a warning.
  +   *
  +   * If the jboss-service.xml file does not specify a
  +   * custom one, then we again default to the standard one.
  +   * @param webDefault
  +   */
  +  public synchronized void
       setWebDefault(String webDefault)
  +  {
  +    if (webDefault != null)
       {
  -        if (webDefault != null)
  -        {
  -            URL webDefaultURL = findResourceInJar(webDefault);
  -            if (webDefaultURL != null)
  -                _webDefault=fixURL(webDefaultURL.toString());
  -            else
  -                _webDefault = null;
  -                _log.warn ("Cannot find resource for "+webDefault+": using 
default");
  -        }
  -        else
  -            _webDefault = null;
  -        
  -        if (_log.isDebugEnabled())
  -           _log.debug ("webdefault specification is: "+_webDefault);
  -        
  -   
  +      URL webDefaultURL = findResourceInJar(webDefault);
  +      if (webDefaultURL != null)
  +     _webDefault=fixURL(webDefaultURL.toString());
  +      else
  +     _webDefault = null;
  +      _log.warn ("Cannot find resource for "+webDefault+": using default");
  +    }
  +    else
  +      _webDefault = null;
  +
  +    if (_log.isDebugEnabled())
  +      _log.debug ("webdefault specification is: "+_webDefault);
  +
  +
     }
   
     public synchronized String
  @@ -244,95 +247,95 @@
   
   
   
  -    
  -    //----------------------------------------
  -    // configuration property
  -    //----------------------------------------
  -
  -    public Element getConfigurationElement ()
  -    {
  -        return _configElement;
  -        
  -    }
  -    
  -    /** 
  -     * @param configElement XML fragment from jboss-service.xml
  -     */
  -    public void setConfigurationElement (Element configElement)
  -    {
  -
  -        // convert to an xml string to pass into Jetty's normal
  -        // configuration mechanism
  -        _configElement = configElement;
  -        
  -        try
  -        {
  -            DOMSource source = new DOMSource(configElement);
  -            
  -            ByteArrayOutputStream stream = new ByteArrayOutputStream();
  -            
  -            StreamResult result = new StreamResult (stream);
  -            
  -            TransformerFactory factory = TransformerFactory.newInstance();
  -            Transformer transformer = factory.newTransformer();
  -            transformer.transform (source, result);
  -            
  -            _xmlConfigString = stream.toString();
  -            
  -            // get rid of the first line, as this will be prepended by
  -            // the XmlConfiguration
  -            int index = _xmlConfigString.indexOf("?>");
  -            if ( index >= 0)
  -            {
  -                index += 2;
  -                
  -                while ((_xmlConfigString.charAt(index) == '\n')
  -                       ||
  -                       (_xmlConfigString.charAt(index) == '\r'))
  -                    index++;
  -            }
  -            
  -            _xmlConfigString = _xmlConfigString.substring(index);
  -
  -            _log.debug ("Passing xml config to jetty:\n"+_xmlConfigString);
  -            
  -            setXMLConfiguration (_xmlConfigString);
  -            
  -         }
  -         catch (TransformerConfigurationException tce)
  -         {
  -             _log.error ("Can't transform config Element -> xml:", tce);
  -         }
  -         catch (TransformerException te)
  -         {
  -             _log.error ("Can't transform config Element -> xml:", te);
  -         }
  -         catch (Exception e)
  -         {
  -             _log.error("Unexpected exception converting configuration Element -> 
xml", e);
  -         }
  -    }
  -    
  -    /* Actually perform the configuration
  -     * @param xmlString 
  -     */
  -    private void setXMLConfiguration (String xmlString)
  -    {
  -        
  -        try
  -        {
  -            XmlConfiguration xmlConfigurator = new XmlConfiguration (xmlString);
  -            xmlConfigurator.configure(this);
  -        }
  -        catch (Exception e)
  -        {
  -            _log.error("problem configuring Jetty:", e);
  -        }
  -    }
  -    
  -    
  -   
  -    
  +
  +  //----------------------------------------
  +  // configuration property
  +  //----------------------------------------
  +
  +  public Element getConfigurationElement ()
  +  {
  +    return _configElement;
  +
  +  }
  +
  +  /**
  +   * @param configElement XML fragment from jboss-service.xml
  +   */
  +  public void setConfigurationElement (Element configElement)
  +  {
  +
  +    // convert to an xml string to pass into Jetty's normal
  +    // configuration mechanism
  +    _configElement = configElement;
  +
  +    try
  +    {
  +      DOMSource source = new DOMSource(configElement);
  +
  +      ByteArrayOutputStream stream = new ByteArrayOutputStream();
  +
  +      StreamResult result = new StreamResult (stream);
  +
  +      TransformerFactory factory = TransformerFactory.newInstance();
  +      Transformer transformer = factory.newTransformer();
  +      transformer.transform (source, result);
  +
  +      _xmlConfigString = stream.toString();
  +
  +      // get rid of the first line, as this will be prepended by
  +      // the XmlConfiguration
  +      int index = _xmlConfigString.indexOf("?>");
  +      if ( index >= 0)
  +      {
  +     index += 2;
  +
  +     while ((_xmlConfigString.charAt(index) == '\n')
  +            ||
  +            (_xmlConfigString.charAt(index) == '\r'))
  +       index++;
  +      }
  +
  +      _xmlConfigString = _xmlConfigString.substring(index);
  +
  +      _log.debug ("Passing xml config to jetty:\n"+_xmlConfigString);
  +
  +      setXMLConfiguration (_xmlConfigString);
  +
  +    }
  +    catch (TransformerConfigurationException tce)
  +    {
  +      _log.error ("Can't transform config Element -> xml:", tce);
  +    }
  +    catch (TransformerException te)
  +    {
  +      _log.error ("Can't transform config Element -> xml:", te);
  +    }
  +    catch (Exception e)
  +    {
  +      _log.error("Unexpected exception converting configuration Element -> xml", e);
  +    }
  +  }
  +
  +  /* Actually perform the configuration
  +   * @param xmlString
  +   */
  +  private void setXMLConfiguration (String xmlString)
  +  {
  +
  +    try
  +    {
  +      XmlConfiguration xmlConfigurator = new XmlConfiguration (xmlString);
  +      xmlConfigurator.configure(this);
  +    }
  +    catch (Exception e)
  +    {
  +      _log.error("problem configuring Jetty:", e);
  +    }
  +  }
  +
  +
  +
  +
   
     //----------------------------------------------------------------------------
     // 'deploy' interface
  @@ -344,6 +347,7 @@
       deploy(String contextPath, String warUrl, WebDescriptorParser descriptorParser)
       throws DeploymentException
     {
  +    _log.info("DEPLOYING contextPath:"+contextPath+" warUrl:"+warUrl);
       WebApplication wa=new WebApplication();
   
       try
  @@ -359,25 +363,25 @@
   
         // deploy the WebApp
         WebApplicationContext app=
  -          new JBossWebApplicationContext(this, contextPath,
  -                                         descriptorParser, wa, _parser,
  -                                         fixedWarUrl,
  -                                         getHttpSessionStorageStrategy(),
  -                                         getHttpSessionSnapshotFrequency(),
  -                                         getHttpSessionSnapshotNotificationPolicy(),
  -                                         getSubjectAttributeName());
  +     new JBossWebApplicationContext(this, contextPath,
  +                                    descriptorParser, wa, _parser,
  +                                    fixedWarUrl,
  +                                    getHttpSessionStorageStrategy(),
  +                                    getHttpSessionSnapshotFrequency(),
  +                                    getHttpSessionSnapshotNotificationPolicy(),
  +                                    getSubjectAttributeName());
  +
   
  -      
         // configure whether the context is to flatten the classes in
  -      // the WAR or not      
  +      // the WAR or not
         app.setExtractWAR (getUnpackWars());
   
   
         // if a different webdefaults.xml file has been provided, use it
         if (getWebDefault() != null)
  -          app.setDefaultsDescriptor (getWebDefault());
  -      
  -      
  +     app.setDefaultsDescriptor (getWebDefault());
  +
  +
         String virtualHost=null;
         addContext(virtualHost, app);
   
  @@ -484,5 +488,11 @@
         // the URL but here we just ignore it
         return url;
       }
  +  }
  +
  +  public String[]
  +    getCompileClasspath(ClassLoader cl)
  +  {
  +    return _service.getCompileClasspath(cl);
     }
   }
  
  
  
  1.51      +22 -28    contrib/jetty/src/main/org/jboss/jetty/JettyService.java
  
  Index: JettyService.java
  ===================================================================
  RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/JettyService.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- JettyService.java 20 Feb 2002 05:37:23 -0000      1.50
  +++ JettyService.java 21 Feb 2002 02:03:57 -0000      1.51
  @@ -5,7 +5,7 @@
    * See terms of license at gnu.org.
    */
   
  -// $Id: JettyService.java,v 1.50 2002/02/20 05:37:23 janb Exp $
  +// $Id: JettyService.java,v 1.51 2002/02/21 02:03:57 jules_gosnell Exp $
   
   //------------------------------------------------------------------------------
   
  @@ -38,7 +38,7 @@
    * A service to launch jetty from JMX.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Julian Gosnell</a>
  - * @version $Revision: 1.50 $
  + * @version $Revision: 1.51 $
    */
   
   public class JettyService
  @@ -47,21 +47,16 @@
   {
   
       public static final String NAME = "Jetty";
  -    
  -    Logger       _log     = Logger.getLogger(JettyService.class);
  -    JettyMBean   _mbean   = null;
  -    CodeMBean    _debug   = null;
  -    Jetty        _jetty   = null;
  -    MBeanServer  _server  = null;
  -    LogMBean     _logbean = null;
  -    ObjectName _codeBeanName = null;
  -    
  -    ObjectName _logBeanName = null;
  -
  -    Element _configElement = null;
  - 
  -    
  -    
  +
  +    Logger      _log           = Logger.getLogger(JettyService.class);
  +    JettyMBean  _mbean         = null;
  +    CodeMBean   _debug         = null;
  +    Jetty       _jetty         = null;
  +    MBeanServer _server        = null;
  +    LogMBean    _logbean       = null;
  +    ObjectName  _codeBeanName  = null;
  +    ObjectName  _logBeanName   = null;
  +    Element     _configElement = null;
   
     public
       JettyService()
  @@ -71,7 +66,6 @@
       // that logging models are connected before configure-time (via
       // MLET file) which is done before initialise-time.
       ensureLogging();
  -
       ensureNaming();
   
     }
  @@ -90,8 +84,8 @@
     }
   
   
  -  
  -    
  +
  +
     //----------------------------------------------------------------------------
   
     public void
  @@ -143,7 +137,7 @@
       //org.mortbay.jetty.jmx.ModelMBeanImpl.setJettyDomain("jboss.web");
   
       // make a Jetty...
  -    Jetty tmp = new Jetty();
  +    Jetty tmp = new Jetty(this);
       tmp.setWebDefault(getWebDefault());
       tmp.setUnpackWars(getUnpackWars());
       tmp.setHttpSessionStorageStrategy(getHttpSessionStorageStrategy());
  @@ -185,7 +179,7 @@
           _log.info("MBean peers WILL NOT be created for Jetty Contexts");
       }
       _jetty.setConfigurationElement (_configElement);
  -    
  +
     }
   
     protected void
  @@ -494,8 +488,8 @@
           else
               return _configElement;
       }
  -    
  -    
  +
  +
       //----------------------------------------------------------------------------
       /** Configure Jetty
        * @param configElement XML fragment from jboss-service.xml
  @@ -509,11 +503,11 @@
   
           if (isInitialised())
               _jetty.setConfigurationElement (configElement);
  -        
  +
            _configElement=configElement;
       }
   
  -    
  +
     protected String _subjectAttributeName=null; // "j_subject"
   
     public String
  @@ -537,7 +531,7 @@
         _subjectAttributeName=subjectAttributeName;
     }
   
  - 
  -    
  +
  +
   
   }
  
  
  

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

Reply via email to