tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/startup EmbededTomcat.java
Date Fri, 29 Dec 2000 01:34:42 GMT
costin      00/12/28 17:34:42

  Modified:    src/etc  server.xml
               src/share/org/apache/tomcat/context DefaultCMSetter.java
               src/share/org/apache/tomcat/modules/config
                        ServerXmlInterceptor.java WorkDirSetup.java
               src/share/org/apache/tomcat/modules/server
                        Ajp12Interceptor.java
               src/share/org/apache/tomcat/startup EmbededTomcat.java
  Log:
  - replaced WorkDirInterceptor with the new ( rewritten ) version.
  The replacement can handle storing the temp files in WEB-INF ( very
  useful for setting policies for the applications ), can use better
  names ( work/HOSTNAME/PATH instead of ugly names ) and of course
  can use the old names.
  Saving temp files in WEB-INF is disabled by default ( according to the spec
  the server can use any internal file-system representation it wants, but
  this needs a bit more review before enabling it by default ). A big
  advantage is that all the files used by a web application are grouped.
  
  - DefaultCMSetter will generate a random number in config. ( for later
  use )
  
  - Ajp12Interceptor will generate a file containing the current port.
  
  The idea is to add a shared "secret" for shutdown, but without requiring
  the user to configure anything - if someone has read access to the
  conf directory, it can read the config file containing the user-configured
  secret as well.
  
  Revision  Changes    Path
  1.58      +1 -1      jakarta-tomcat/src/etc/server.xml
  
  Index: server.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/etc/server.xml,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- server.xml	2000/12/29 00:33:13	1.57
  +++ server.xml	2000/12/29 01:34:40	1.58
  @@ -131,7 +131,7 @@
   
   
           <ContextInterceptor 
  -            className="org.apache.tomcat.context.WorkDirInterceptor" />
  +            className="org.apache.tomcat.modules.config.WorkDirSetup" />
   
           <!-- Request processing -->
           <!-- Session interceptor will extract the session id from cookies and 
  
  
  
  1.60      +16 -0     jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java
  
  Index: DefaultCMSetter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- DefaultCMSetter.java	2000/12/26 23:02:00	1.59
  +++ DefaultCMSetter.java	2000/12/29 01:34:41	1.60
  @@ -145,6 +145,22 @@
           initLoggers(cm.getLoggers());
       }
   
  +    /** Generate a random number
  +     */
  +    public void engineStart( ContextManager cm )
  +	throws TomcatException
  +    {
  +	try {
  +	    PrintWriter stopF=new PrintWriter
  +		(new FileWriter(cm.getHome() + "/conf/random.txt"));
  +	    stopF.println( Math.random() );
  +	    stopF.close();
  +	} catch( IOException ex ) {
  +	    log( "Can't create stop file " + ex );
  +	}
  +    }
  +    
  +
       private void initLoggers(Hashtable Loggers){
           if( Loggers!=null ){
               Enumeration el=Loggers.elements();
  
  
  
  1.2       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ServerXmlInterceptor.java
  
  Index: ServerXmlInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ServerXmlInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServerXmlInterceptor.java	2000/12/28 21:08:05	1.1
  +++ ServerXmlInterceptor.java	2000/12/29 01:34:41	1.2
  @@ -60,7 +60,6 @@
   
   import java.beans.*;
   import java.io.*;
  -import java.io.IOException;
   import java.lang.reflect.*;
   import java.util.Hashtable;
   import java.util.*;
  @@ -69,6 +68,7 @@
   import org.apache.tomcat.helper.*;
   import org.apache.tomcat.util.xml.*;
   import org.apache.tomcat.core.*;
  +import org.apache.tomcat.modules.server.*;
   import org.apache.tomcat.util.log.*;
   import org.xml.sax.*;
   
  
  
  
  1.2       +17 -4     jakarta-tomcat/src/share/org/apache/tomcat/modules/config/WorkDirSetup.java
  
  Index: WorkDirSetup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/WorkDirSetup.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WorkDirSetup.java	2000/12/04 21:22:49	1.1
  +++ WorkDirSetup.java	2000/12/29 01:34:41	1.2
  @@ -78,6 +78,7 @@
       boolean cleanWorkDir=false;
       String workdirBase=null;
       boolean useWebInf=false;
  +    boolean oldStyle=false;
       
       public WorkDirSetup() {
       }
  @@ -107,6 +108,10 @@
       public void setUseWebInf( boolean useWebInf ) {
   	this.useWebInf = useWebInf;
       }
  +
  +    public void setOldStyle( boolean b ) {
  +	this.oldStyle=b;
  +    }
       
       // -------------------- Callbacks --------------------
       
  @@ -186,6 +191,8 @@
   	if( base==null )
   	    base=cm.getWorkDir();
   
  +	File workDirF=null;
  +
   	StringBuffer sb=new StringBuffer();
   	sb.append(cm.getWorkDir());
   	sb.append(File.separator);
  @@ -194,11 +201,17 @@
   	    sb.append( "DEFAULT" );
   	else
   	    sb.append( host );
  -	File hostD=new File( sb.toString());
  -	hostD.mkdirs();
  -
  -	File workDirF=new File( hostD, URLEncoder.encode( ctx.getPath() ));
   	
  +
  +	if( oldStyle ) {
  +	    sb.append(URLEncoder.encode( ctx.getPath() ));
  +	    workDirF=new File(sb.toString());
  +	} else {
  +	    File hostD=new File( sb.toString());
  +	    hostD.mkdirs();
  +	    
  +	    workDirF=new File( hostD, URLEncoder.encode( ctx.getPath() ));
  +	}
   	ctx.setWorkDir( workDirF );
       }
   
  
  
  
  1.8       +27 -0     jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp12Interceptor.java
  
  Index: Ajp12Interceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp12Interceptor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Ajp12Interceptor.java	2000/12/17 02:37:55	1.7
  +++ Ajp12Interceptor.java	2000/12/29 01:34:42	1.8
  @@ -86,6 +86,33 @@
   	ep.setConnectionHandler( this );
       }
   
  +    public void engineInit(ContextManager cm )
  +	throws TomcatException
  +    {
  +	super.engineInit( cm );
  +	BaseInterceptor ci[]=cm.getContainer().getInterceptors();
  +	for( int i=0; i<ci.length; i++ ) {
  +	    Object con=ci[i];
  +	    if( con instanceof  Ajp12Interceptor ) {
  +		Ajp12Interceptor tcpCon=(Ajp12Interceptor) con;
  +		int portInt=tcpCon.getPort();
  +		InetAddress address=tcpCon.getAddress();
  +		try {
  +		    PrintWriter stopF=new PrintWriter
  +			(new FileWriter(cm.getHome() + "/conf/ajp12.id"));
  +		    stopF.println( portInt );
  +		    if( address==null )
  +			stopF.println( "" );
  +		    else
  +			stopF.println( address.toString() );
  +		    stopF.close();
  +		} catch( IOException ex ) {
  +		    log( "Can't create ajp12.id " + ex );
  +		}
  +	    }
  +	}
  +    }
  +
       // -------------------- Handler implementation --------------------
   
       public Object[] init() {
  
  
  
  1.39      +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java
  
  Index: EmbededTomcat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- EmbededTomcat.java	2000/12/28 21:08:06	1.38
  +++ EmbededTomcat.java	2000/12/29 01:34:42	1.39
  @@ -259,7 +259,7 @@
   	"org.apache.tomcat.context.PolicyInterceptor",
   	"org.apache.tomcat.context.LoaderInterceptor12",
   	"org.apache.tomcat.context.ErrorHandler",
  -	"org.apache.tomcat.context.WorkDirInterceptor",
  +	"org.apache.tomcat.modules.config.WorkDirSetup",
   	"org.apache.tomcat.modules.session.SessionId",
   	"org.apache.tomcat.request.SimpleMapper1",
   	"org.apache.tomcat.request.InvokerInterceptor",
  
  
  

Mime
View raw message