3 Replies Latest reply on Sep 4, 2006 5:34 AM by mike golan

    Directory Listing

    mike golan Newbie

      Hello everybody..

      i have a quistion :
      how can i avoid directory listing in my App.. i mean when i go to
      http://localhost:8080/somedir/index.jsp i get the start page but what i want is that
      when i go to
      http://localhost:8080/somedir/otherdir then should be dent to start site and avoid to list all directorys under "otherdir"....

      please help me

        • 1. Re: Directory Listing
          jaikiran pai Master

          You can set this option in the web.xml file present at: %JBOSS_HOME%/server/default/deploy/jbossweb-tomcat41.sar/META-INF directory.

          In this web.xml you will find something like:

          <!-- ================== Built In Servlet Definitions ==================== -->
          
          
           <!-- The default servlet for all web applications, that serves static -->
           <!-- resources. It processes all requests that are not mapped to other -->
           <!-- servlets with servlet mappings (defined either here or in your own -->
           <!-- web.xml file. This servlet supports the following initialization -->
           <!-- parameters (default values are in square brackets): -->
           <!-- -->
           <!-- debug Debugging detail level for messages logged -->
           <!-- by this servlet. [0] -->
           <!-- -->
           <!-- input Input buffer size (in bytes) when reading -->
           <!-- resources to be served. [2048] -->
           <!-- -->
           <!-- listings Should directory listings be produced if there -->
           <!-- is no welcome file in this directory? [true] -->
           <!-- -->
           <!-- output Output buffer size (in bytes) when writing -->
           <!-- resources to be served. [2048] -->
           <!-- -->
           <!-- readonly Is this context "read only", so HTTP -->
           <!-- commands like PUT and DELETE are -->
           <!-- rejected? [true] -->
          
           <servlet>
           <servlet-name>default</servlet-name>
           <servlet-class>
           org.apache.catalina.servlets.DefaultServlet
           </servlet-class>
           <init-param>
           <param-name>debug</param-name>
           <param-value>0</param-value>
           </init-param>
           <init-param>
           <param-name>listings</param-name>
           <param-value>true</param-value>
           </init-param>
           <load-on-startup>1</load-on-startup>
           </servlet>


          You will have to change the 'listings' init param value to false:

          <init-param>
           <param-name>listings</param-name>
           <param-value>false</param-value>
           </init-param>




          • 2. Re: Directory Listing
            Anders Hedstrom Novice

            Set the servlet param listings to false in this file:

            $JBOSS_HOME/server/<your_conf>/deploy/jbossweb-tomcat55.sar/conf/web.xml

            setting to change:

            <servlet>
             <servlet-name>default</servlet-name>
             <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
             <init-param>
             <param-name>debug</param-name>
             <param-value>0</param-value>
             </init-param>
             <init-param>
             <param-name>listings</param-name>
             <param-value>false</param-value>
             </init-param>
             <load-on-startup>1</load-on-startup>
             </servlet>


            • 3. Re: Directory Listing
              mike golan Newbie

              thank u very much