5 Replies Latest reply on Aug 29, 2012 4:49 PM by Lukas Kalinski

    Enabling directory listings on JBoss AS 7

    Lukas Kalinski Newbie

      Hi!

       

      During the past 24 hours I've been googling myself to death on this. How on earth do you enable directory listings in JBoss AS 7? I've seen a lot of answers to that question involving setting <init-param>s in some default web.xml. The problem is (maybe no surprise) that I do not have any other web.xml, except for the one included in my project.

       

      Please help, this is something that needs to be solved ASAP (deadline this midnight, and this is not the only one to do before that time).

       

      Thanks,

      Lukas

        • 1. Re: Enabling directory listings on JBoss AS 7
          Nicklas Karlsson Master

          Not sure but the jboss-as-web_1_2.xsd speaks of

           

             <xs:complexType name="static-resourcesType">

                <xs:attribute name="listings" default="false" type="xs:boolean" />

           

          check out the xsd for details

          1 of 1 people found this helpful
          • 2. Re: Enabling directory listings on JBoss AS 7
            Jay SenSharma Master

            Hi Lukas,

             

                        Try running the following CLI command to enable diectory listing:

             

            In Domain Mode

            /profile=full/subsystem=web/configuration=static-resources/:write-attribute(name=listings,value=true)

             

             

            In Standalone Mode

            /subsystem=web/configuration=static-resources/:write-attribute(name=listings,value=true)

             

             

            It will generate following kind of configuration :

             

                        <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">

             

                            <configuration>

                                <static-resources listings="true"/>

                            </configuration>

             

             

                            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

                            <virtual-server name="default-host" enable-welcome-root="true">

                                <alias name="localhost"/>

                                <alias name="example.com"/>

                            </virtual-server>

                        </subsystem>

            • 3. Re: Enabling directory listings on JBoss AS 7
              Nicklas Karlsson Master

              And next time, do yourself a favor and don't promise your customer tight deadlines when there are many unknown factors (new tech etc) ;-)

              • 4. Re: Enabling directory listings on JBoss AS 7
                Lukas Kalinski Newbie

                Thank you, it worked as you explained! However, I still can't get the actual listing to work, and this time I suspect it has something to do with Spring being involved in mapping to static resources. Anyway, if you want, you could give a hint on best practices regarding serving static non-common (i.e. app specific) content and how to make it available through directory listings.

                 

                Currently I use Spring's:

                <mvc:resources mapping="/res/**" location="/public-resources/" />

                 

                Mybe that's not the way to go?

                 

                By the way, while I'm personally not in critical need of this explanation anymore, it might be useful for somebody someday.

                • 5. Re: Enabling directory listings on JBoss AS 7
                  Lukas Kalinski Newbie

                  Thank you for your answer!

                   

                  I know what you mean regarding the deadline ("been there, done that", so to say), but this time it's a course... and the teacher sets the deadlines!