tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/task ApacheConfig.java
Date Tue, 25 Apr 2000 00:38:11 GMT
craigmcc    00/04/24 17:38:11

  Modified:    src/share/org/apache/tomcat/task ApacheConfig.java
  Log:
  Correct generation of the "conf/tomcat-apache.conf" file to deal with
  absolute pathnames to the document root.  In addition, all directory paths
  generated in this file are now quoted.
  
  Also, the "AddType" directive for JSP pages has been corrected from
  "test/jsp" to "text/jsp".
  
  PR: 279
  Submitted by: author@philhanna.com
  
  Revision  Changes    Path
  1.7       +17 -13    jakarta-tomcat/src/share/org/apache/tomcat/task/ApacheConfig.java
  
  Index: ApacheConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/task/ApacheConfig.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ApacheConfig.java	2000/03/01 00:40:23	1.6
  +++ ApacheConfig.java	2000/04/25 00:38:11	1.7
  @@ -109,12 +109,12 @@
   	    
   	    // XXX read it from ContextManager
   	    pw.println("ApJServDefaultPort 8007");
  -
   	    pw.println();
  -	    pw.println("AddType test/jsp .jsp");
  +
  +	    pw.println("AddType text/jsp .jsp");
   	    pw.println("AddHandler jserv-servlet .jsp");
  +	    pw.println();
   
  -	    
   	    // Set up contexts 
   	    
   	    Enumeration enum = cm.getContextNames();
  @@ -122,24 +122,27 @@
   		String path=(String)enum.nextElement();
   		Context context = cm.getContext(path);
   		if( path.length() > 1) {
  +
   		    // It's not the root context
   		    // assert path.startsWith( "/" )
   
  -		    // Static files will be served by Apache
  -		    pw.println("Alias " + path + " " + 
  -                               FileUtil.patch(tomcatHome + "/webapps" + path));
  +		    // Calculate the absolute path of the document base
  +		    String docBase = context.getDocBase();
  +		    if (!FileUtil.isAbsolute(docBase))
  +			docBase = tomcatHome + "/" + docBase;
  +		    docBase = FileUtil.patch(docBase);
   
  -		    pw.println("<Directory \"" +
  -			       FileUtil.patch(tomcatHome + "/webapps" + path) +
  -			       "\">");
  +		    // Static files will be served by Apache
  +		    pw.println("Alias " + path + " \"" + docBase + "\"");
  +		    pw.println("<Directory \"" + docBase + "\">");
   		    pw.println("    Options Indexes FollowSymLinks");
   		    pw.println("</Directory>");
   		    
  -		    // Dynamic /servet pages go to tomcat
  +		    // Dynamic /servet pages go to Tomcat
   		    pw.println("ApJServMount " + path +"/servlet" + " " + path);
   
  -		    // Deny WEB-INF
  -		    pw.println("<Location " + path + "/WEB-INF/ >");
  +		    // Deny serving any files from WEB-INF
  +		    pw.println("<Location \"" + path + "/WEB-INF/\">");
   		    pw.println("    AllowOverride None");
   		    pw.println("    deny from all");
   		    pw.println("</Location>");
  @@ -187,7 +190,8 @@
   	} catch( Exception ex ) {
   	    //	    ex.printStackTrace();
   	    //throw new TomcatException( "Error generating Apache config", ex );
  -	    System.out.println("Failed to generate automatic apache configuration " + ex.toString());
  +	    System.out.println("Error generating automatic apache configuration " + ex);
  +	    ex.printStackTrace(System.out);
   	}
   	    
       }
  
  
  

Mime
View raw message