nacho       01/02/05 18:46:31

  Modified:    .        build.xml
               src/facade22/org/apache/tomcat/facade JspInterceptor.java
               src/share/org/apache/jasper/compiler JasperMangler.java
               src/share/org/apache/tomcat/modules/config
                        LoaderInterceptor11.java
               src/share/org/apache/tomcat/startup Main.java Tomcat.java
               src/share/org/apache/tomcat/util/compat Jdk11Compat.java
                        Jdk12Support.java
  Added:       src/shell startup2.bat tomcat2.bat
  Log:
  This commit is intented to let Tomcat33
  to use a classloader for internal classes
  isolating tomcat internal classes on
  his own classloader and with a common
  repository with only servlet.jar in it ...
  
  * Start a webapp in a true isolated sandbox shielded from any jar needed to run 
Tomcat itself i.e no more xml parser & coocon blues :)
  
  * Be able to mix isolated ( aka trusted ) and non isolated apps in the same server.
  
  Sorry to send only bats i dont know sh at all..
  but they only start Tomcat with only a jar in classpath tomcat.jar,
  basicly it contains classes needed for bootstraping tomcat and can be used on jdk11 
systems too.
  
  build the new dir layout doing "build new",
  and using "startup2.bat" to start it,
  then you can try i.e use crimson for tomcat
  and xerces for Cocoon without put xerces in
  the server classpath.
  
  Revision  Changes    Path
  1.107     +30 -0     jakarta-tomcat/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/build.xml,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- build.xml 2001/01/25 05:07:32     1.106
  +++ build.xml 2001/02/06 02:46:24     1.107
  @@ -78,6 +78,8 @@
          file="${ant.home}/lib/parser.jar"/>
       <copy tofile="${tomcat.build}/lib/jaxp.jar" file="${jaxp}/jaxp.jar"/>
       <copy tofile="${tomcat.build}/lib/parser.jar" file="${jaxp}/parser.jar"/>
  +    <copy tofile="${tomcat.build}/lib/jaxp.jar" file="${jaxp}/jaxp.jar"/>
  +    <copy tofile="${tomcat.build}/lib/crimson.jar" file="${jaxp}/crimson.jar"/>
       
       <!-- This act as a "default", Tomcat3.3 will not load it in
            classpath, just a hack to ease the transition
  @@ -401,6 +403,33 @@
       <zip zipfile="${Name}-${version}.zip" basedir="${tomcat.dist}" includes="**"/>
     </target>
     
  +  <target name="dist-new" depends="dist">
  +    <mkdir dir="${tomcat.dist}/lib/shared"/>
  +    <mkdir dir="${tomcat.dist}/lib/common"/>
  +    <copy file ="${tomcat.dist}/lib/servlet.jar"
  +        todir="${tomcat.dist}/lib/common" />
  +    <copy file ="${tomcat.dist}/lib/jasper.jar"
  +        todir="${tomcat.dist}/lib/shared" />
  +    <copy file ="${tomcat.dist}/lib/tomcat_util.jar"
  +        todir="${tomcat.dist}/lib/shared" />
  +  </target>
  +
  +  <target name="new" depends="main">
  +    <mkdir dir="${tomcat.build}/lib/shared"/>
  +    <mkdir dir="${tomcat.build}/lib/common"/>
  +    <copy file ="${tomcat.build}/lib/servlet.jar"
  +        todir="${tomcat.build}/lib/common" />
  +    <copy file ="${tomcat.build}/lib/jasper.jar"
  +        todir="${tomcat.build}/lib/shared" />
  +    <copy file ="${tomcat.build}/lib/tomcat_util.jar"
  +        todir="${tomcat.build}/lib/shared" />
  +<!--
  +    <delete>
  +        <fileset dir="${tomcat.build}/classes"/>
  +    </delete>
  +-->
  +  </target>
  +
   
     <!-- ==================== Admin & agreagate ==================== -->
      
  @@ -417,6 +446,7 @@
       <delete dir="${tomcat.build}"/>
       <delete dir="${tomcat.dist}"/>
     </target>
  +
     
     <target name="all" depends="clean,dist"/>
     <target name="main" depends="tomcat,webapps,sanity-test"/>
  
  
  
  1.12      +23 -7     
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/JspInterceptor.java
  
  Index: JspInterceptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/JspInterceptor.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JspInterceptor.java       2001/02/01 04:44:57     1.11
  +++ JspInterceptor.java       2001/02/06 02:46:25     1.12
  @@ -51,7 +51,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - */ 
  + */
   package org.apache.tomcat.facade;
   
   import javax.servlet.*;
  @@ -67,6 +67,7 @@
   import org.apache.tomcat.util.log.*;
   import org.apache.tomcat.util.*;
   import org.apache.tomcat.util.depend.*;
  +import org.apache.tomcat.util.compat.*;
   
   import org.apache.jasper.*;
   import org.apache.jasper.Constants;
  @@ -594,6 +595,7 @@
           javac.setEncoding(javaEncoding);
        String cp=System.getProperty("java.class.path")+ sep + 
            ctxt.getClassPath() + sep + ctxt.getOutputDir();
  +//        System.out.println("classpath:"+cp);
           javac.setClasspath( cp );
        if( debug>5) log.log( "ClassPath " + cp);
        
  @@ -652,16 +654,29 @@
       }
   
       private String computeClassPath(Context ctx) {
  -     URL classP[]=ctx.getClassPath();
        String separator = System.getProperty("path.separator", ":");
  +     URL classP[]=ctx.getClassPath();
           String cpath = "";
  -        for(int i=0; i< classP.length; i++ ) {
  -            URL cp = classP[i];
  +        cpath+=extractClassPath(classP);
  +        Jdk11Compat jdkProxy=Jdk11Compat.getJdkCompat();
  +        URL serverCP[];
  +        URL commonCP[];
  +        serverCP=jdkProxy.getParentURLs(this.getClass().getClassLoader());
  +        commonCP=jdkProxy.getURLs(this.getClass().getClassLoader());
  +        cpath+=separator+extractClassPath(serverCP);
  +        cpath+=separator+extractClassPath(commonCP);
  +     return cpath;
  +    }
  +    String extractClassPath(URL urls[]){
  +     String separator = System.getProperty("path.separator", ":");
  +        String cpath="";
  +        for(int i=0; i< urls.length; i++ ) {
  +            URL cp = urls[i];
               File f = new File( cp.getFile());
               if (cpath.length()>0) cpath += separator;
               cpath += f;
           }
  -     return cpath;
  +        return cpath;
       }
   
       private JspCompilationContext createCompilationContext( Request req,
  @@ -672,13 +687,14 @@
        ctxt.setServletClassName( mangler.getClassName());
        ctxt.setJspFile( req.servletPath().toString());
        ctxt.setClassPath( computeClassPath( req.getContext()) );
  +//        System.out.println("computeClasspath:"+ctxt.getClassPath());
        ctxt.setServletContext( req.getContext().getFacade());
        ctxt.setOptions( opt );
        ctxt.setClassLoader( req.getContext().getClassLoader());
        ctxt.setOutputDir(req.getContext().getWorkDir().getAbsolutePath());
        return ctxt;
       }
  -    
  +
       // Add an "expire check" to the generated servlet.
       private Dependency setDependency( Context ctx, JasperMangler mangler,
                                      ServletHandler handler )
  @@ -710,6 +726,6 @@
        info.setDependency( dep );
        return dep;
       }
  -     
  +
   
   }
  
  
  
  1.2       +2 -2      
jakarta-tomcat/src/share/org/apache/jasper/compiler/JasperMangler.java
  
  Index: JasperMangler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JasperMangler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JasperMangler.java        2001/01/28 05:54:35     1.1
  +++ JasperMangler.java        2001/02/06 02:46:25     1.2
  @@ -214,7 +214,7 @@
            pkgDir=JavaGeneratorTool.manglePackage(pkgDir);
            pkgDir=pkgDir.replace('.', '_');
            pkgDir=fixInvalidChars( pkgDir );
  -         classDir=workDir + "/" + pkgDir;
  +         classDir=workDir + File.separator + pkgDir;
        } else {
            classDir=workDir;
        }
  @@ -250,7 +250,7 @@
   
       private void updateVersionPaths() {
        // version dependent stuff
  -     String baseName=classDir + "/" + JavaGeneratorTool.
  +     String baseName=classDir + File.separator + JavaGeneratorTool.
            getVersionedName( baseClassN, version);
        
        javaFileName= baseName + ".java";
  
  
  
  1.6       +1 -1      
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LoaderInterceptor11.java
  
  Index: LoaderInterceptor11.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LoaderInterceptor11.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LoaderInterceptor11.java  2001/01/28 19:20:34     1.5
  +++ LoaderInterceptor11.java  2001/02/06 02:46:26     1.6
  @@ -156,7 +156,7 @@
        }
   
        ClassLoader parent=null;
  -     if( useAL )
  +     if( useAL && !context.isTrusted() )
            parent=cm.getParentLoader();
        else if( useNoParent )
            parent=null;
  
  
  
  1.18      +106 -69   jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Main.java 2000/12/29 00:20:21     1.17
  +++ Main.java 2001/02/06 02:46:27     1.18
  @@ -81,10 +81,14 @@
    * include a single jar file in the classpath.
    *
    * @author Costin Manolache
  + * @author Ignacio J. Ortega
  + *
    */
   public class Main {
       String installDir;
       String libBase;
  +    String serverBase;
  +    String commonBase;
       String homeDir;
       static final String DEFAULT_CONFIG="conf/server.xml";
       boolean doStop=false;
  @@ -109,20 +113,19 @@
        System.out.println("TomcatStartup: " + s );
       }
   
  -    // -------------------- Guess tomcat.home --------------------
  -
  -    
       // -------------------- Utils --------------------
       
  -    public void setLibDir( String base ) {
  +    public String checkDir( String base ) {
  +        String r=null;
           try {
            File f = new File(base);
  -         this.libBase = f.getCanonicalPath();
  -         if( ! libBase.endsWith("/") ) libBase+="/";
  +         r = f.getCanonicalPath();
  +         if( ! r.endsWith("/") ) r+="/";
           } catch (IOException ioe) {
            ioe.printStackTrace();
  -         libBase=base;
  +            r=base;
           }
  +        return r;
       }
   
       URL getURL( String base, String file ) {
  @@ -141,71 +144,64 @@
           }
       }
   
  -    public String getLibDir() {
  +    public String getServerDir() {
        if( libBase!=null ) return libBase;
   
  -     String pkg=IntrospectionUtils.guessHome("tomcat.home", "tomcat.jar");
  -     System.out.println("Guessed home=" + pkg);
  -     if( pkg!=null ) setLibDir( pkg + "/lib");
  -     else setLibDir("./lib");
  +     if( homeDir!=null ) libBase=checkDir( homeDir + "/lib");
  +     else libBase=checkDir("./lib");
        return libBase;
       }
  +    public String getSharedDir() {
  +     if( serverBase!=null ) return serverBase;
   
  -    
  -    void execute( String args[] ) throws Exception {
  +     if( homeDir!=null ) serverBase=checkDir( homeDir + "/lib/shared");
  +     else serverBase=checkDir("./lib/shared");
  +     return serverBase;
  +    }
  +    public String getCommonDir() {
  +     if( commonBase!=null ) return commonBase;
  +
  +     if( homeDir!=null ) commonBase=checkDir( homeDir + "/lib/common");
  +     else commonBase=checkDir("./lib/common");
  +     return commonBase;
  +    }
   
  -     try {
  -         Vector urlV=new Vector();
  -            String cpComp[]=getJarFiles(getLibDir());
  -         int jarCount=cpComp.length;
  -            urlV.addElement( getURL(  getLibDir() ,"../classes/" ));
  -         for( int i=0; i< jarCount ; i++ ) {
  -             urlV.addElement( getURL(  getLibDir() , cpComp[i] ));
  -         }
   
  -         // add CLASSPATH
  -         String cpath=System.getProperty( "tomcat.cp");
  -         if( cpath!=null ) {
  -             System.out.println("Extra CLASSPATH: " + cpath);
  -             String pathSep=System.getProperty( "path.separator");
  -             StringTokenizer st=new StringTokenizer( cpath, pathSep );
  -             while( st.hasMoreTokens() ) {
  -                 String path=st.nextToken();
  -                 urlV.addElement( getURL( path, "" ));
  -             }
  -         }
  +    void execute( String args[] ) throws Exception {
   
  -         // Add tools.jar if JDK1.2
  -         String java_home=System.getProperty( "java.home" );
  -         urlV.addElement( new URL( "file", null , java_home +
  -                                    "/../lib/tools.jar"));
  -         
  -         URL urls[]=new URL[ urlV.size() ];
  -         System.out.println("CLASSPATH: " );
  -         for( int i=0; i<urlV.size(); i++ ) {
  -             urls[i]=(URL)urlV.elementAt( i );
  -             System.out.print(":" + urls[i] );
  -         }
  -         System.out.println();
  -         System.out.println();
  -         
  -         ClassLoader parentL=this.getClass().getClassLoader();
  -         System.out.println("ParentL " + parentL );
  +        try {
  +            homeDir=IntrospectionUtils.guessHome("tomcat.home", "tomcat.jar");
  +            System.out.println("Guessed home=" + homeDir);
   
  -         ClassLoader cl=null;
  -         cl= IntrospectionUtils.getURLClassLoader( urls, parentL );
  -         if( cl==null )
  -             cl=new SimpleClassLoader(urls, parentL);
  +         ClassLoader parentL=this.getClass().getClassLoader();
  +         //System.out.println("ParentL " + parentL );
  +            // the server classloader loads from classes dir too and from tools.jar
  +            Vector urlV=new Vector();
  +            urlV.addElement( getURL(  getServerDir() ,"../classes/" ));
  +            urlV.addAll(getClassPathA(getServerDir()));
  +         urlV.addElement( new URL( "file", null , System.getProperty( "java.home" ) 
+"/../lib/tools.jar"));
  +            URL[] serverClassPath=getURLs(urlV);
  +            // ClassLoader for webapps it uses a shared dir as repository, distinct 
from lib
  +            URL[] sharedClassPath=getURLs(getClassPathA(getSharedDir()));
  +            URL[] commonClassPath=getURLs(getClassPathA(getCommonDir()));
  +            ClassLoader commonCl= 
IntrospectionUtils.getURLClassLoader(commonClassPath , parentL );
  +         ClassLoader sharedCl= IntrospectionUtils.getURLClassLoader(sharedClassPath 
, commonCl );
  +            ClassLoader serverCl= 
IntrospectionUtils.getURLClassLoader(serverClassPath , commonCl );
  +         if( commonCl==null ) {
  +             commonCl=new SimpleClassLoader(commonClassPath, parentL);
  +             sharedCl=new SimpleClassLoader(sharedClassPath, commonCl);
  +             serverCl=new SimpleClassLoader(serverClassPath, commonCl);
  +            }
   
  -         
  -         Class cls=cl.loadClass("org.apache.tomcat.startup.Tomcat");
  +            System.out.println("commonCl:"+commonCl);
  +            System.out.println("sharedCl:"+sharedCl);
  +            System.out.println("serverCl:"+serverCl);
  +         Class cls=serverCl.loadClass("org.apache.tomcat.startup.Tomcat");
            Object proxy=cls.newInstance();
  -         
  -         processArgs( proxy, args );
  -         //      IntrospectionUtils.setAttribute( proxy,
  -         //               "parentClassLoader", parentL );
  -         //      setAttribute( proxy, "serverClassPath", urls );
  -         IntrospectionUtils.execute(  proxy, "execute" );
  +
  +            IntrospectionUtils.setAttribute( proxy,"args", args );
  +            IntrospectionUtils.setAttribute( proxy,"parentClassLoader", sharedCl );
  +            IntrospectionUtils.execute(  proxy, "executeWithAttributes" );
            return;
        } catch( Exception ex ) {
            ex.printStackTrace();
  @@ -218,16 +214,16 @@
          String name;
          String aliases[];
          int args;
  -       
  +
          boolean task;
          }
       */
  +/*
       String args0[]= { "help", "stop", "g", "generateConfigs" };
       String args1[]= { "f", "config", "h", "home" };
   
  -    /** Read command line arguments and set properties in proxy,
  +     Read command line arguments and set properties in proxy,
        using ant-like patterns
  -    */
       void processArgs(Object proxy, String args[] )
        throws Exception
       {
  @@ -254,20 +250,61 @@
            }
        }
       }
  -
  +*/
       public String[] getJarFiles(String ld) {
        File dir = new File(ld);
  -     String[] names = dir.list( new FilenameFilter(){
  +        String[] names=null;
  +        if (dir.isDirectory()){
  +            names = dir.list( new FilenameFilter(){
               public boolean accept(File d, String name) {
  -                if (name.endsWith(".jar"))
  -                {
  +                if (name.endsWith(".jar")){
                       return true;
                   }
                   return false;
               }
  -        });
  +            });
  +        }
  +
        return names;
       }
  +
  +    Vector getClassPathA(String p0) throws Exception {
  +        Vector urlV=new Vector();
  +        try{
  +            String cpComp[]=getJarFiles(p0);
  +            if (cpComp != null){
  +                int jarCount=cpComp.length;
  +                for( int i=0; i< jarCount ; i++ ) {
  +                    urlV.addElement( getURL(  p0 , cpComp[i] ));
  +                }
  +            }
  +         // add CLASSPATH
  +         String cpath=System.getProperty( "tomcat.cp");
  +         if( cpath!=null ) {
  +             System.out.println("Extra CLASSPATH: " + cpath);
  +             String pathSep=System.getProperty( "path.separator");
  +             StringTokenizer st=new StringTokenizer( cpath, pathSep );
  +             while( st.hasMoreTokens() ) {
  +                 String path=st.nextToken();
  +                 urlV.addElement( getURL( path, "" ));
  +             }
  +         }
  +
  +
  +        }catch(Exception ex){
  +            ex.printStackTrace();
  +        }
  +        return urlV;
  +    }
  +
  +    private URL[] getURLs(Vector v){
  +        URL[] urls=new URL[ v.size() ];
  +     for( int i=0; i<v.size(); i++ ) {
  +            urls[i]=(URL)v.elementAt( i );
  +        }
  +        return urls;
  +    }
  +
   
   
   }
  
  
  
  1.51      +33 -13    jakarta-tomcat/src/share/org/apache/tomcat/startup/Tomcat.java
  
  Index: Tomcat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/Tomcat.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- Tomcat.java       2001/02/01 06:24:34     1.50
  +++ Tomcat.java       2001/02/06 02:46:28     1.51
  @@ -13,6 +13,7 @@
   import org.apache.tomcat.core.*;
   import org.apache.tomcat.util.log.*;
   import org.xml.sax.*;
  +import org.apache.tomcat.util.collections.*;
   
   /**
    * Starter for Tomcat using XML.
  @@ -29,9 +30,10 @@
   
       // null means user didn't set one
       String configFile=null;
  -    // relative to TOMCAT_HOME 
  +    // relative to TOMCAT_HOME
       static final String DEFAULT_CONFIG="conf/server.xml";
  -    
  +    SimpleHashtable attributes=new SimpleHashtable();;
  +
       public Tomcat() {
        super("tc_log");
       }
  @@ -51,8 +53,8 @@
        try {
            StopTomcat task=
                new  StopTomcat();
  -         
  -         //      task.setConfig( configFile );
  +
  +//       task.setConfig( configFile );
            task.execute();     
        }
        catch (TomcatException te) {
  @@ -73,23 +75,28 @@
        ServerXmlReader sxmlConf=new ServerXmlReader();
        sxmlConf.setConfig( configFile );
        tcat.addInterceptor( sxmlConf );
  -
  +        ClassLoader cl=(ClassLoader)attributes.get("parentClassLoader");
  +        System.out.println("parentClassLoader:"+cl);
  +        System.out.println("thisClassLoader:"+this.getClass().getClassLoader());
  +        if (cl==null) cl=this.getClass().getClassLoader();
  +        System.out.println("parentClassLoader:"+cl);
  +        tcat.getContextManager().setParentLoader(cl);
        tcat.initContextManager();
  -     
  +
        tcat.start();
       }
   
       public void setAction(String s ) {
        action=s;
       }
  -    
  +
       public static void main(String args[] ) {
        try {
            Tomcat tomcat=new Tomcat();
  -         if( ! tomcat.processArgs( args )) {
  -             tomcat.setAction("help");
  -         }
  -         tomcat.execute();
  +            if( ! tomcat.processArgs( args )) {
  +                tomcat.setAction("help");
  +            }
  +            tomcat.execute();
        } catch(Exception ex ) {
            System.out.println(sm.getString("tomcat.fatal"));
            System.err.println(Logger.throwableToString(ex));
  @@ -115,7 +122,7 @@
       public  boolean processArgs(String[] args) {
        for (int i = 0; i < args.length; i++) {
            String arg = args[i];
  -            
  +
            if (arg.equals("-help") || arg.equals("help")) {
                action="help";
                return false;
  @@ -138,6 +145,19 @@
            }
        }
        return true;
  -    }        
  +    }
   
  +    public void setAttribute(String s,Object o) {
  +        attributes.put(s,o);
  +        System.out.println(s+":"+o);
  +    }
  +    public void executeWithAttributes() throws Exception {
  +       String[] args=(String[])attributes.get("args");
  +        if ( args != null ){
  +            if( ! processArgs( args )) {
  +                setAction("help");
  +            }
  +        } else setAction("help");
  +        execute();
  +    }
   }
  
  
  
  1.2       +7 -0      
jakarta-tomcat/src/share/org/apache/tomcat/util/compat/Jdk11Compat.java
  
  Index: Jdk11Compat.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/compat/Jdk11Compat.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Jdk11Compat.java  2001/01/25 05:07:40     1.1
  +++ Jdk11Compat.java  2001/02/06 02:46:30     1.2
  @@ -112,6 +112,13 @@
        return null;
       }
   
  +    public URL[] getURLs(ClassLoader cl){
  +        return ((SimpleClassLoader)cl).getURLs();
  +    }
  +    public URL[] getParentURLs(ClassLoader cl){
  +        SimpleClassLoader scl=(SimpleClassLoader)cl;
  +        return ((SimpleClassLoader)cl.getParent()).getURLs();
  +    }
       // Other methods, as needed
           
   
  
  
  
  1.2       +8 -0      
jakarta-tomcat/src/share/org/apache/tomcat/util/compat/Jdk12Support.java
  
  Index: Jdk12Support.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/compat/Jdk12Support.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Jdk12Support.java 2001/01/25 05:07:40     1.1
  +++ Jdk12Support.java 2001/02/06 02:46:30     1.2
  @@ -104,6 +104,14 @@
        return Thread.currentThread().getContextClassLoader();
       }
   
  +    public URL[] getURLs(ClassLoader cl){
  +        return ((URLClassLoader)cl).getURLs();
  +    }
  +    public URL[] getParentURLs(ClassLoader cl){
  +        URLClassLoader scl=(URLClassLoader)cl;
  +        return ((URLClassLoader)cl.getParent()).getURLs();
  +    }
  +
       // -------------------- Support -------------------- 
       static class PrivilegedProxy implements PrivilegedExceptionAction
       {
  
  
  
  1.1                  jakarta-tomcat/src/shell/startup2.bat
  
  Index: startup2.bat
  ===================================================================
  @echo off
  rem $Id: startup2.bat,v 1.1 2001/02/06 02:46:31 nacho Exp $
  rem Startup batch file for tomcat server.
  
  rem This batch file written and tested under Windows NT
  rem Improvements to this file are welcome
  
  if not "%TOMCAT_HOME%" == "" goto start
  
  SET TOMCAT_HOME=.
  if exist "%TOMCAT_HOME%\bin\tomcat.bat" goto start
  
  SET TOMCAT_HOME=..
  if exist "%TOMCAT_HOME%\bin\tomcat.bat" goto start
  
  SET TOMCAT_HOME=
  echo Unable to determine the value of TOMCAT_HOME.
  goto eof
  
  :start
  call "%TOMCAT_HOME%\bin\tomcat2" start -config conf\server2.xml %1 %2 %3 %4 %5 %6 %7 
%8 %9
  
  :eof
  
  
  
  1.1                  jakarta-tomcat/src/shell/tomcat2.bat
  
  Index: tomcat2.bat
  ===================================================================
  @echo off
  rem -------------------------------------------------------------------------
  rem tomcat.bat - Start/Stop Script for the TOMCAT Server
  rem
  rem Environment Variable Prerequisites:
  rem
  rem   TOMCAT_HOME  (Optional) May point at your Tomcat distribution
  rem                directory.  If not present, the current working
  rem                directory is assumed.
  rem                Note: This batch file does not function properly
  rem                if TOMCAT_HOME contains spaces.
  rem
  rem   TOMCAT_OPTS  (Optional) Java runtime options used when the "start",
  rem                "stop", or "run" command is executed
  rem
  rem   CLASSPATH    (Optional) This batch file will automatically add
  rem                what Tomcat needs to the CLASSPATH.  This consists
  rem                of TOMCAT_HOME\classes and all the jar files in
  rem                TOMCAT_HOME\lib. This will include the "jaxp.jar"
  rem                and "parser.jar" files from the JAXP Reference
  rem                implementation, and the "tools.jar" from the JDK.
  rem
  rem   JAVA_HOME    Must point at your Java Development Kit installation.
  rem
  rem $Id: tomcat2.bat,v 1.1 2001/02/06 02:46:31 nacho Exp $
  rem -------------------------------------------------------------------------
  
  
  rem ----- Save Environment Variables That May Change ------------------------
  
  set _CP=%CP%
  set _TOMCAT_HOME=%TOMCAT_HOME%
  set _CLASSPATH=%CLASSPATH%
  
  rem ----- Internal Environment Vars used somewhere --------------------------
  
  set TEST_JAR=lib\tomcat.jar
  
  rem ----- Verify and Set Required Environment Variables ---------------------
  
  if not "%JAVA_HOME%" == "" goto gotJavaHome
  echo You must set JAVA_HOME to point at your Java Development Kit installation
  goto cleanup
  :gotJavaHome
  
  if not "%TOMCAT_HOME%" == "" goto gotTomcatHome
  set TOMCAT_HOME=.
  :gotTomcatHome
  if exist "%TOMCAT_HOME%\%TEST_JAR%" goto okTomcatHome
  echo Unable to locate %TEST_JAR%, check the value of TOMCAT_HOME.
  goto cleanup
  :okTomcatHome
  
  
  rem ----- Prepare Appropriate Java Execution Commands -----------------------
  
  if not "%OS%" == "Windows_NT" goto noTitle
  set _SECSTARTJAVA=start "Secure Tomcat 3.3" "%JAVA_HOME%\bin\java"
  set _STARTJAVA=start "Tomcat 3.3" "%JAVA_HOME%\bin\java"
  set _RUNJAVA="%JAVA_HOME%\bin\java"
  goto setClasspath
  
  :noTitle
  set _SECSTARTJAVA=start "%JAVA_HOME%\bin\java"
  set _STARTJAVA=start "%JAVA_HOME%\bin\java"
  set _RUNJAVA="%JAVA_HOME%\bin\java"
  
  :setClasspath
  
  set CLASSPATH=%TOMCAT_HOME%\lib\tomcat.jar
  
  rem ----- Execute The Requested Command -------------------------------------
  
  :execute
  
  if "%1" == "start" goto startServer
  if "%1" == "stop" goto stopServer
  if "%1" == "run" goto runServer
  if "%1" == "ant" goto runAnt
  if "%1" == "env" goto doEnv
  if "%1" == "jspc" goto runJspc
  
  :doUsage
  echo Usage:  tomcat ( ant ^| env ^| jspc ^| run ^| start ^| stop )
  echo Commands:
  echo   ant -   Run Ant in Tomcat's environment
  echo   env -   Set up environment variables that Tomcat would use
  echo   jspc -  Run JSPC in Tomcat's environment
  echo   run -   Start Tomcat in the current window
  echo   start - Start Tomcat in a separate window
  echo   stop -  Stop Tomcat
  goto cleanup
  
  :doEnv
  goto finish
  
  :startServer
  echo Starting Tomcat in new window
  if "%2" == "-security" goto startSecure
  %_STARTJAVA% %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%" 
org.apache.tomcat.startup.Main %2 %3 %4 %5 %6 %7 %8 %9
  goto cleanup
  
  :startSecure
  echo Starting Tomcat with a SecurityManager
  %_SECSTARTJAVA% %TOMCAT_OPTS% -Djava.security.manager 
-Djava.security.policy=="%TOMCAT_HOME%/conf/tomcat.policy" 
-Dtomcat.home="%TOMCAT_HOME%" org.apache.tomcat.startup.Main %3 %4 %5 %6 %7 %8 %9
  goto cleanup
  
  :runServer
  rem Running Tomcat in this window
  if "%2" == "-security" goto runSecure
  %_RUNJAVA% %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%" 
org.apache.tomcat.startup.Main %2 %3 %4 %5 %6 %7 %8 %9
  goto cleanup
  
  :runSecure
  rem Running Tomcat with a SecurityManager
  %_RUNJAVA% %TOMCAT_OPTS% -Djava.security.manager 
-Djava.security.policy=="%TOMCAT_HOME%/conf/tomcat.policy" 
-Dtomcat.home="%TOMCAT_HOME%" org.apache.tomcat.startup.Main %3 %4 %5 %6 %7 %8 %9
  goto cleanup
  
  :stopServer
  rem Stopping the Tomcat Server
  %_RUNJAVA% %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%" 
org.apache.tomcat.startup.Main -stop %2 %3 %4 %5 %6 %7 %8 %9
  goto cleanup
  
  :runAnt
  rem Run ANT in Tomcat's Environment
  set CP=%CP%;%TOMCAT_HOME%\lib\ant.jar
  %_RUNJAVA% %ANT_OPTS% -Dant.home="%TOMCAT_HOME%" -Dtomcat.home="%TOMCAT_HOME%" 
org.apache.tools.ant.Main %2 %3 %4 %5 %6 %7 %8 %9
  goto cleanup
  
  :runJspc
  rem Run JSPC in Tomcat's Environment
  %_RUNJAVA% %JSPC_OPTS% -Dtomcat.home="%TOMCAT_HOME%" org.apache.jasper.JspC %2 %3 %4 
%5 %6 %7 %8 %9
  goto cleanup
  
  
  rem ----- Restore Environment Variables ---------------------------------------
  
  :cleanup
  set TEST_JAR=
  set _LIBJARS=
  set _SECSTARTJAVA=
  set _STARTJAVA=
  set _RUNJAVA=
  set CLASSPATH=%_CLASSPATH%
  set _CLASSPATH=
  set TOMCAT_HOME=%_TOMCAT_HOME%
  set _TOMCAT_HOME=
  set CP=%_CP%
  set _CP=
  :finish
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to