User: oberg   
  Date: 00/12/21 08:29:49

  Modified:    tomcat/src/main/org/jboss/tomcat
                        ContextClassLoaderInterceptor.java
                        EmbeddedTomcatService.java
                        EmbeddedTomcatServiceMBean.java
  Log:
  JNDI lookups of EJB's from JSPs/servlets work now
  Remove JndiRequestInterceptor (Jdk12Interceptor does the job just as well)
  Changed DTD for jboss-web.xml to be more like the J2EE DTD's
  
  Revision  Changes    Path
  1.5       +15 -18    
contrib/tomcat/src/main/org/jboss/tomcat/ContextClassLoaderInterceptor.java
  
  Index: ContextClassLoaderInterceptor.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/contrib/tomcat/src/main/org/jboss/tomcat/ContextClassLoaderInterceptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ContextClassLoaderInterceptor.java        2000/12/07 15:39:13     1.4
  +++ ContextClassLoaderInterceptor.java        2000/12/21 16:29:48     1.5
  @@ -1,35 +1,32 @@
   /*
  - * jBoss, the OpenSource EJB server
  + * JBoss, the OpenSource EJB server
    *
  - * Distributable under GPL license.
  + * Distributable under LGPL license.
    * See terms of license at gnu.org.
    */
  - 
  -
  -
   package org.jboss.tomcat;
   
   import org.apache.tomcat.core.BaseInterceptor;
   import org.apache.tomcat.core.TomcatException;
   import org.apache.tomcat.core.Context;
   import org.apache.tomcat.loader.AdaptiveClassLoader;
  +import org.apache.tomcat.loader.AdaptiveServletLoader;
   
   /**
  - *   <description>
  + *   This interceptor makes sure that the servlet loader has the right parent 
classloader
    *   
  - *   @see <related>
  + *   @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
    *   @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
  - *   @version $Revision: 1.4 $
  + *   @version $Revision: 1.5 $
    */
  -public class ContextClassLoaderInterceptor extends BaseInterceptor {
  -
  -    public ContextClassLoaderInterceptor() {
  -    }
  -
  -    public void contextInit( Context context) throws TomcatException {
  -             
  -      
context.getServletLoader().setParentLoader(Thread.currentThread().getContextClassLoader());
  -      context.getContextManager().setWorkDir("work");
  -    }
  +public class ContextClassLoaderInterceptor 
  +   extends BaseInterceptor 
  +{
  +    public void contextInit( Context context) 
  +      throws TomcatException 
  +   {
  +      
((AdaptiveClassLoader)context.getServletLoader().getParentLoader()).setParent(Thread.currentThread().getContextClassLoader());
  +      
Thread.currentThread().setContextClassLoader(((ClassLoader)context.getServletLoader().getClassLoader()));
  +   }
   
   }
  
  
  
  1.9       +229 -221  
contrib/tomcat/src/main/org/jboss/tomcat/EmbeddedTomcatService.java
  
  Index: EmbeddedTomcatService.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/contrib/tomcat/src/main/org/jboss/tomcat/EmbeddedTomcatService.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- EmbeddedTomcatService.java        2000/12/12 15:38:45     1.8
  +++ EmbeddedTomcatService.java        2000/12/21 16:29:48     1.9
  @@ -1,11 +1,9 @@
   /*
  - * jBoss, the OpenSource EJB server
  + * JBoss, the OpenSource EJB server
    *
  - * Distributable under GPL license.
  + * Distributable under LGPL license.
    * See terms of license at gnu.org.
    */
  -
  -
   package org.jboss.tomcat;
   
   //import java.io.IOException;
  @@ -49,73 +47,68 @@
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.DocumentBuilder;
   
  -
  -
  -
   /**
    *   A service to launch tomcat from JMX.
    *
    *   This uses the class org.apache.tomcat.startup.EmbededTomcat, which means
    *   that we can add and remove tomcat "contexts" on the fly.
    *
  - *   If you use this service, Tomcat's server.xml file will NOT be processed, so
  - *   you have to add all contexts through JMX.
  + *   If you use this service, the contexts defined in Tomcat's server.xml file 
  + *   will be used, but all other info in that file will be ignored.
    *
  - *   @see <related>
  + *   @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
    *   @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
    *   @author <a href="mailto:[EMAIL PROTECTED]">Kevin Lewis</a>
  - *   @version $Revision: 1.8 $
  + *   @version $Revision: 1.9 $
    */
   public class EmbeddedTomcatService extends ServiceMBeanSupport
  -     implements EmbeddedTomcatServiceMBean, MBeanRegistration {
  +     implements EmbeddedTomcatServiceMBean, MBeanRegistration 
  +{
   
  -     // Constants -----------------------------------------------------
  -     public static final String NAME = "EmbeddedTomcat";
  +   // Constants -----------------------------------------------------
  +   public static final String NAME = "EmbeddedTomcat";
   
  -     // Attributes ----------------------------------------------------
  +   // Attributes ----------------------------------------------------
   
  -     // the tomcat launcher
  -     private EmbededTomcat embededTomcat;
  +   // the tomcat launcher
  +   private EmbededTomcat embededTomcat;
   
  -     // the path to tomcat. We need it to set the root context
  -     String tomcatHome;
  +   // the path to tomcat. We need it to set the root context
  +   String tomcatHome;
   
  -     // the port tomcat must listen to
  -     int port;
  +   // the port tomcat must listen to
  +   int port;
   
      // the config file to be used
  -
      String configFile;
  -
  -     // repository for deployed URLs and the associated servletContexts
  -     Hashtable deployedURLs = new Hashtable();
   
  -     final Log log = Log.createLog(NAME);
  +   // repository for deployed URLs and the associated servletContexts
  +   Hashtable deployedURLs = new Hashtable();
   
  -     // Static --------------------------------------------------------
  +   final Log log = Log.createLog(NAME);
   
  -     // Constructors --------------------------------------------------
  -
  -     public EmbeddedTomcatService()
  -     {
  -             this(null, 8080);
  -     }
  +   // Constructors --------------------------------------------------
  +   public EmbeddedTomcatService()
  +   {
  +      this(null, 8080);
  +   }
   
  -     public EmbeddedTomcatService(String configFile, int port)
  +   public EmbeddedTomcatService(String configFile, int port)
      {
  -        this.configFile = configFile;
  -             this.port = port;
  -     }
  +      this.configFile = configFile;
  +      this.port = port;
  +   }
   
  -     public void setPort(int port)
  -     {
  -        this.port = port;
  -     }
  +   // Public --------------------------------------------------------
  +   public void setPort(int port)
  +   {
  +      this.port = port;
  +   }
   
  -     public int getPort()
  -     {
  -        return port;
  -     }
  +   public int getPort()
  +   {
  +      return port;
  +   }
   
      public void setConfigFile(String configFile)
      {
  @@ -127,279 +120,294 @@
         return configFile;
      }
   
  -     // Public --------------------------------------------------------
  -     public ObjectName getObjectName(MBeanServer server, ObjectName name)
  -             throws javax.management.MalformedObjectNameException {
  +   // Public --------------------------------------------------------
  +   public ObjectName getObjectName(MBeanServer server, ObjectName name)
  +   throws javax.management.MalformedObjectNameException
  +   {
   
  -             return new ObjectName(OBJECT_NAME);
  -     }
  +      return name == null ? new ObjectName(OBJECT_NAME) : name;
  +   }
   
  -     public String getName() {
  -             return NAME;
  -     }
  +   public String getName()
  +   {
  +      return NAME;
  +   }
   
   
  -     public void startService() throws Exception {
  -        Log.setLog(log);
  +   public void startService() throws Exception
  +   {
  +      Log.setLog(log);
   
  -             Logger.log("Testing if Tomcat is present....");
  +      Logger.log("Testing if Tomcat is present....");
   
  -             // tomcat (jdk12Interceptor) seems sets the contextclassloader but 
doesn't restore the original one
  -             ClassLoader oldCcl = Thread.currentThread().getContextClassLoader();
  +      // tomcat (jdk12Interceptor) seems sets the contextclassloader but doesn't 
restore the original one
  +      ClassLoader oldCcl = Thread.currentThread().getContextClassLoader();
   
  -             try {
  -                     // We need the tomcat home to set tomcat's working dir / ROOT 
context
  -                     Class tomcatClass;
  -                     try {
  -                             tomcatClass = 
Class.forName("org.apache.tomcat.startup.EmbededTomcat");
  +      try
  +      {
  +         // We need the tomcat home to set tomcat's working dir / ROOT context
  +         Class tomcatClass;
  +         try {
  +            tomcatClass = Class.forName("org.apache.tomcat.startup.EmbededTomcat");
   
  -                     } catch (Exception e) {
  +         } catch(Exception e)
  +         {
   
  -                             Logger.log("failed");
  -                             Logger.log("Tomcat not found.  You need tomcat 
3.2b4+");
  -                             throw new Exception("start failed");
  -                     }
  +            Logger.log("failed");
  +            Logger.log("Tomcat not found.  You need tomcat 3.2b4+");
  +            throw new Exception("start failed");
  +         }
   
  -                     URL tomcatUrl = 
tomcatClass.getProtectionDomain().getCodeSource().getLocation();
  -                     tomcatHome = new File(new 
File(tomcatUrl.getFile()).getParent()).getParent();
  +         URL tomcatUrl = 
tomcatClass.getProtectionDomain().getCodeSource().getLocation();
  +         tomcatHome = new File(new 
File(tomcatUrl.getFile()).getParent()).getParent();
   
            // Locate server.xml
  -         if (configFile == null)
  +         if(configFile == null)
            {
               configFile = new File(tomcatHome, "conf/server.xml").toString();
  -            System.out.println("Config file set to:"+configFile);
            }
   
  -                     try {
  +         try
  +         {
   
  -                             // Using EmbededTomcat instead of 
org.apache.tomcat.startup.Tomcat
  -                             // allows us to add/remove contexts on the fly
  -                             embededTomcat = new EmbededTomcat();
  -                             Logger.log("OK");
  +            // Using EmbededTomcat instead of org.apache.tomcat.startup.Tomcat
  +            // allows us to add/remove contexts on the fly
  +            embededTomcat = new EmbededTomcat();
  +            Logger.log("OK");
   
  -                     } catch (NoClassDefFoundError e) {
  -                             Logger.log("failed");
  -                             Logger.log("org.apache.tomcat.startup.EmbededTomcat 
wasn't found. Be sure to have your CLASSPATH correctly set");
  -                             Logger.log("You need tomcat 3.2b4+ to use this 
service");
  +         } catch(NoClassDefFoundError e)
  +         {
  +            Logger.log("failed");
  +            Logger.log("org.apache.tomcat.startup.EmbededTomcat wasn't found. Be 
sure to have your CLASSPATH correctly set");
  +            Logger.log("You need tomcat 3.2b4+ to use this service");
   
  -                             throw e;
  -                     }
  +            throw e;
  +         }
   
  -                     // Initialize the EmbededTomcat object.
  -                     // See javadoc in org.apache.tomcat.startup.EmbededTomcat
  +         // Initialize the EmbededTomcat object.
  +         // See javadoc in org.apache.tomcat.startup.EmbededTomcat
   
  -                     // set debug  (Warning: setting debug to anything higher gave 
me lot of exceptions)
  -                     embededTomcat.setDebug(0);
  +         // set debug  (Warning: setting debug to anything higher gave me lot of 
exceptions)
  +         embededTomcat.setDebug(0);
   
  -                     embededTomcat.setWorkDir(tomcatHome);
  +         embededTomcat.setWorkDir(tomcatHome+"/work");
   
  -                     // set the interceptors.
  -                     addInterceptors(embededTomcat);
  +         // set the interceptors.
  +         addInterceptors(embededTomcat);
   
  -                     // add root context
  -                     deploy("/", "file:" + tomcatHome + "/webapps/ROOT");
  +         // add root context
  +         deploy("/", "file:" + tomcatHome + "/webapps/ROOT");
   
            // add contexts from file
   
            // Create an instance of the DocumentBuilderFactory
  -         
System.out.println(Class.forName("javax.xml.parsers.DocumentBuilderFactory"));
  -
  -           com.sun.xml.parser.DocumentBuilderFactoryImpl docBuilderFactory = new 
com.sun.xml.parser.DocumentBuilderFactoryImpl();
  +         com.sun.xml.parser.DocumentBuilderFactoryImpl docBuilderFactory = new 
com.sun.xml.parser.DocumentBuilderFactoryImpl();
   
  -           //Get the DocumentBuilder from the factory that we just got above.
  -           com.sun.xml.parser.DocumentBuilderImpl docBuilder = 
(com.sun.xml.parser.DocumentBuilderImpl)docBuilderFactory.newDocumentBuilder();
  +         //Get the DocumentBuilder from the factory that we just got above.
  +         com.sun.xml.parser.DocumentBuilderImpl docBuilder = 
(com.sun.xml.parser.DocumentBuilderImpl)docBuilderFactory.newDocumentBuilder();
   
  -           // parse the config file
  +         // parse the config file
            // ROB: it�s not bulletproof maybe should validate against a dtd file
  -           Document doc = docBuilder.parse(new File(configFile));
  +         Document doc = docBuilder.parse(new File(configFile));
   
            // get list with contexts
            NodeList contexts = doc.getElementsByTagName("Context");
   
   
            // add them
  -         for(int i=0; i<contexts.getLength(); i++) {
  +         for(int i=0; i<contexts.getLength(); i++)
  +         {
               Element context = (Element)contexts.item(i);
               String path = context.getAttribute("path");
               String docBase = context.getAttribute("docBase");
               File f = new File(docBase);
               // check if docbase is of type /something in which case add tomcat home
  -            if(!f.exists()) {
  +            if(!f.exists())
  +            {
                  deploy(path, "file:" + tomcatHome + "/" + docBase);
                  //System.out.println("file:" + tomcatHome + "/" + docBase);
               }
   
               // otherwise if it�s c:/something do nothing
  -            else {
  +            else
  +            {
                  deploy(path, "file:" + docBase);
                  //System.out.println("file:" + docBase);
               }
            }
   
   
  -                     // add endpoint (web service)
  -                     embededTomcat.addEndpoint(port, null, null);
  +         // add endpoint (web service)
  +         embededTomcat.addEndpoint(port, null, null);
   
  -                     // start
  -                     embededTomcat.start();
  +         // start
  +         embededTomcat.start();
   
  -             } finally {
  +      } finally
  +      {
   
  -                     // restore the original value of the ccl.
  -                     Thread.currentThread().setContextClassLoader(oldCcl);
  +         // restore the original value of the ccl.
  +         Thread.currentThread().setContextClassLoader(oldCcl);
   
  -                     // unset log for the main thread.
  -                     // tomcat's child threads have a copy of it anyway.
  -                     Log.unsetLog();
  -             }
  -     }
  +         // unset log for the main thread.
  +         // tomcat's child threads have a copy of it anyway.
  +         Log.unsetLog();
  +      }
  +   }
   
   
  -     public void stopService() {
  -             // NYI in tomcat for now (3.2b6)
  -             embededTomcat.stop();
  -     }
  +   public void stopService()
  +   {
  +      // NYI in tomcat for now (3.2b6)
  +      embededTomcat.stop();
  +   }
  +
   
  +   // warURL could be given as a java.net.URL, but the JMX RI's html adaptor can't
  +   // show inputs for URLs in HTML forms.
  +   public void deploy(String ctxPath, String warUrl) throws DeploymentException
  +   {
  +      Log.setLog(log);
   
  -     // warURL could be given as a java.net.URL, but the JMX RI's html adaptor can't
  -     // show inputs for URLs in HTML forms.
  -     public void deploy(String ctxPath, String warUrl) throws DeploymentException {
  -             Log.setLog(log);
  +      ClassLoader oldCcl = Thread.currentThread().getContextClassLoader();
  +      try
  +      {
   
  -             try {
  -                     // add the context
  -                     ServletContext servletCtx = embededTomcat.addContext(ctxPath, 
new URL(warUrl));
  +         // add the context
  +         ServletContext servletCtx = embededTomcat.addContext(ctxPath, new 
URL(warUrl));
   
  -                     // init the context
  -                     embededTomcat.initContext(servletCtx);
  +         // init the context
  +         embededTomcat.initContext(servletCtx);
   
  -                     // keep track of deployed contexts for undeployment
  -                     deployedURLs.put(warUrl, servletCtx);
  +         // keep track of deployed contexts for undeployment
  +         deployedURLs.put(warUrl, servletCtx);
   
  -             } catch (Error e)
  +      } catch(Error e)
         {
  -        e.printStackTrace();
  -        throw e;
  -      } catch (Exception e) {
  -                     e.printStackTrace();
  -                     throw new DeploymentException(e.getMessage());
  -             } finally {
  -                     Log.unsetLog();
  -             }
  -     }
  -
  +         e.printStackTrace();
  +         throw e;
  +      } catch(Exception e)
  +      {
  +         e.printStackTrace();
  +         throw new DeploymentException(e.getMessage());
  +      } finally
  +      {
  +         Log.unsetLog();
  +         Thread.currentThread().setContextClassLoader(oldCcl);
  +      }
  +   }
   
  -     public void undeploy(String warUrl) throws DeploymentException {
  -             Log.setLog(log);
   
  -             try {
  -                     // find the javax.servlet.ServletContext in the repository
  -                     ServletContext servletCtx = 
(ServletContext)deployedURLs.get(warUrl);
  +   public void undeploy(String warUrl) throws DeploymentException
  +   {
  +      Log.setLog(log);
   
  -                     if (servletCtx == null)
  -                             throw new DeploymentException("URL " + warUrl + " is 
not deployed");
  +      try
  +      {
  +         // find the javax.servlet.ServletContext in the repository
  +         ServletContext servletCtx = (ServletContext)deployedURLs.get(warUrl);
   
  -                     // remove the context
  -                     embededTomcat.removeContext(servletCtx);
  +         if(servletCtx == null)
  +            throw new DeploymentException("URL " + warUrl + " is not deployed");
   
  -             } catch (Exception e) {
  -                     throw new DeploymentException(e.getMessage());
  -             } finally {
  -                     Log.unsetLog();
  -             }
  +         // remove the context
  +         embededTomcat.removeContext(servletCtx);
   
  -     }
  +      } catch(Exception e)
  +      {
  +         throw new DeploymentException(e.getMessage());
  +      } finally
  +      {
  +         Log.unsetLog();
  +      }
   
  +   }
   
  -     public boolean isDeployed(String warUrl) {
  -             return deployedURLs.containsKey(warUrl);
  -     }
   
  +   public boolean isDeployed(String warUrl)
  +   {
  +      return deployedURLs.containsKey(warUrl);
  +   }
   
  -     // Protected -----------------------------------------------------
   
  -    protected void addContextInterceptors(EmbededTomcat tomcat) {
  -             // Since we add one non-default interceptor, we have to specif them all
  -             // the list comes from org.apache.tomcat.startup.EmbededTomcat
  +   // Protected -----------------------------------------------------
   
  -             WebXmlReader webXmlI=new WebXmlReader();
  -             webXmlI.setValidate( false );
  -             tomcat.addContextInterceptor( webXmlI );
  +   protected void addContextInterceptors(EmbededTomcat tomcat)
  +   {
  +      // Since we add one non-default interceptor, we have to specify them all
  +      // the list comes from org.apache.tomcat.startup.EmbededTomcat
   
  -             PolicyInterceptor polI=new PolicyInterceptor();
  -             tomcat.addContextInterceptor( polI );
  -             polI.setDebug(0);
  +      WebXmlReader webXmlI=new WebXmlReader();
  +      webXmlI.setValidate(false);
  +      tomcat.addContextInterceptor(webXmlI);
   
  -             LoaderInterceptor loadI=new LoaderInterceptor();
  -             tomcat.addContextInterceptor( loadI );
  +      PolicyInterceptor polI=new PolicyInterceptor();
  +      tomcat.addContextInterceptor(polI);
  +      polI.setDebug(0);
   
  -        tomcat.addContextInterceptor( new 
org.jboss.tomcat.naming.JbossWebXmlReader() );
  +      LoaderInterceptor loadI=new LoaderInterceptor();
  +      tomcat.addContextInterceptor(loadI);
   
  -             ContextClassLoaderInterceptor ccli = new 
ContextClassLoaderInterceptor();
  -             tomcat.addContextInterceptor(ccli);
  +      ContextClassLoaderInterceptor ccli = new ContextClassLoaderInterceptor();
  +      tomcat.addContextInterceptor(ccli);
   
  -             DefaultCMSetter defaultCMI=new DefaultCMSetter();
  -             tomcat.addContextInterceptor( defaultCMI );
  +      DefaultCMSetter defaultCMI=new DefaultCMSetter();
  +      tomcat.addContextInterceptor(defaultCMI);
   
  -             WorkDirInterceptor wdI=new WorkDirInterceptor();
  -             tomcat.addContextInterceptor( wdI );
  +      WorkDirInterceptor wdI=new WorkDirInterceptor();
  +      tomcat.addContextInterceptor(wdI);
   
  -             LoadOnStartupInterceptor loadOnSI=new LoadOnStartupInterceptor();
  -             tomcat.addContextInterceptor( loadOnSI );
  -    }
  +      tomcat.addContextInterceptor(new org.jboss.tomcat.naming.JbossWebXmlReader());
   
  -    protected void addSecurityRequestInterceptors(EmbededTomcat tomcat) {
  -    }
  +      LoadOnStartupInterceptor loadOnSI=new LoadOnStartupInterceptor();
  +      tomcat.addContextInterceptor(loadOnSI);
  +   }
   
  -    protected void addRequestInterceptors(EmbededTomcat tomcat) {
  -             // Debug
  -             //      LogEvents logEventsI=new LogEvents();
  -             //      addRequestInterceptor( logEventsI );
  +   protected void addSecurityRequestInterceptors(EmbededTomcat tomcat)
  +   {
  +   }
   
  -             // this one is custom
  -             // set context class loader
  -        // New interceptor.
  -        tomcat.addRequestInterceptor( new 
org.jboss.tomcat.naming.JndiRequestInterceptor() );
  +   protected void addRequestInterceptors(EmbededTomcat tomcat)
  +   {
   
  -             SessionInterceptor sessI=new SessionInterceptor();
  -             tomcat.addRequestInterceptor( sessI );
  +      Jdk12Interceptor jdk12I=new Jdk12Interceptor();
  +      tomcat.addRequestInterceptor(jdk12I);
   
  -             SimpleMapper1 mapI=new SimpleMapper1();
  -             tomcat.addRequestInterceptor( mapI );
  -             mapI.setDebug(0);
  +      // Debug
  +      //     LogEvents logEventsI=new LogEvents();
  +      //     addRequestInterceptor( logEventsI );
   
  -             InvokerInterceptor invI=new InvokerInterceptor();
  -             tomcat.addRequestInterceptor( invI );
  -             invI.setDebug(0);
  +      SessionInterceptor sessI=new SessionInterceptor();
  +      tomcat.addRequestInterceptor(sessI);
   
  -             StaticInterceptor staticI=new StaticInterceptor();
  -             tomcat.addRequestInterceptor( staticI );
  -             mapI.setDebug(0);
  +      SimpleMapper1 mapI=new SimpleMapper1();
  +      tomcat.addRequestInterceptor(mapI);
  +      mapI.setDebug(0);
   
  -             tomcat.addRequestInterceptor( new StandardSessionInterceptor());
  +      InvokerInterceptor invI=new InvokerInterceptor();
  +      tomcat.addRequestInterceptor(invI);
  +      invI.setDebug(0);
   
  -             // access control ( find if a resource have constraints )
  -             AccessInterceptor accessI=new AccessInterceptor();
  -             tomcat.addRequestInterceptor( accessI );
  -             accessI.setDebug(0);
  +      StaticInterceptor staticI=new StaticInterceptor();
  +      tomcat.addRequestInterceptor(staticI);
  +      mapI.setDebug(0);
   
  -             Jdk12Interceptor jdk12I=new Jdk12Interceptor();
  -             tomcat.addRequestInterceptor( jdk12I );
  +      tomcat.addRequestInterceptor(new StandardSessionInterceptor());
   
  -        addSecurityRequestInterceptors(tomcat);
  -    }
  +      // access control ( find if a resource have constraints )
  +      AccessInterceptor accessI=new AccessInterceptor();
  +      tomcat.addRequestInterceptor(accessI);
  +      accessI.setDebug(0);
   
  -     // Private -------------------------------------------------------
  +      addSecurityRequestInterceptors(tomcat);
  +   }
   
  -     private void addInterceptors(EmbededTomcat tomcat) {
  +   // Private -------------------------------------------------------
   
  -        try {
  -            addContextInterceptors(tomcat);
  -            addRequestInterceptors(tomcat);
  -        }
  -        catch (Throwable e) {
  -            System.out.println("Error initializing embedded Tomcat service.");
  -            e.printStackTrace(System.out);
  -        }
  -     }
  +   private void addInterceptors(EmbededTomcat tomcat)
  +   {
  +      addContextInterceptors(tomcat);
  +      addRequestInterceptors(tomcat);
  +   }
   }
  +
  
  
  
  1.4       +11 -9     
contrib/tomcat/src/main/org/jboss/tomcat/EmbeddedTomcatServiceMBean.java
  
  Index: EmbeddedTomcatServiceMBean.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/contrib/tomcat/src/main/org/jboss/tomcat/EmbeddedTomcatServiceMBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EmbeddedTomcatServiceMBean.java   2000/12/07 15:39:13     1.3
  +++ EmbeddedTomcatServiceMBean.java   2000/12/21 16:29:48     1.4
  @@ -1,24 +1,24 @@
   /*
  - * jBoss, the OpenSource EJB server
  + * JBoss, the OpenSource EJB server
    *
  - * Distributable under GPL license.
  + * Distributable under LGPL license.
    * See terms of license at gnu.org.
    */
    
  - 
   package org.jboss.tomcat;
   
   import org.jboss.ejb.DeploymentException;
   
  -
   /**
  - *   <description> 
  + *   Management interface for the Embedded Tomcat service
    *      
    *   @see <related>
    *   @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
  - *   @version $Revision: 1.3 $
  + *   @version $Revision: 1.4 $
    */
  -public interface EmbeddedTomcatServiceMBean extends org.jboss.util.ServiceMBean {
  +public interface EmbeddedTomcatServiceMBean 
  +   extends org.jboss.util.ServiceMBean 
  +{
        
        // Constants -----------------------------------------------------
        public static final String OBJECT_NAME = ":service=EmbeddedTomcat";
  @@ -30,9 +30,11 @@
      public void setConfigFile(String configFile);
      public String getConfigFile();
      
  -     public void deploy(String ctxPath, String warUrl) throws DeploymentException;
  +     public void deploy(String ctxPath, String warUrl) 
  +      throws DeploymentException;
        
  -     public void undeploy(String warUrl) throws DeploymentException;
  +     public void undeploy(String warUrl) 
  +      throws DeploymentException;
        
        public boolean isDeployed(String warUrl);
   
  
  
  

Reply via email to