You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/07/25 03:54:04 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/request StaticInterceptor.java

craigmcc    00/07/24 18:54:03

  Modified:    src/etc  server.xml
               src/share/org/apache/tomcat/request StaticInterceptor.java
  Log:
  Allow directory listings (when there is no welcome file present) to be
  optionally disabled, by setting the "listings" property of the static file
  interceptor to "false".  The default value remains "true".
  
  Revision  Changes    Path
  1.32      +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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- server.xml	2000/07/11 02:12:37	1.31
  +++ server.xml	2000/07/25 01:54:03	1.32
  @@ -134,7 +134,7 @@
             -->
           <RequestInterceptor 
               className="org.apache.tomcat.request.StaticInterceptor" 
  -            debug="0" />
  +            debug="0" listings="true" />
   
           <!-- Plug a session manager. You can plug in more advanced session
                modules.
  
  
  
  1.10      +12 -1     jakarta-tomcat/src/share/org/apache/tomcat/request/StaticInterceptor.java
  
  Index: StaticInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/StaticInterceptor.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StaticInterceptor.java	2000/07/11 03:48:51	1.9
  +++ StaticInterceptor.java	2000/07/25 01:54:03	1.10
  @@ -83,6 +83,16 @@
       public StaticInterceptor() {
       }
   
  +    /**
  +     * Should directory listings be generated when there is
  +     * no welcome file present?
  +     */
  +    private boolean listings = true;
  +
  +    public void setListings(boolean listings) {
  +	this.listings = listings;
  +    }
  +
       public void engineInit(ContextManager cm) throws TomcatException {
   	super.engineInit( cm );
   	
  @@ -104,7 +114,8 @@
   	dirHandler.setNoteId( realFileNote );
   	debug=0;
   	ctx.addServlet( fileHandler );
  -	ctx.addServlet( dirHandler);
  +	if (listings)
  +	    ctx.addServlet( dirHandler );
   	fileHandler.setDebug( debug );
   	dirHandler.setDebug( debug );
       }