4 Replies Latest reply on Sep 12, 2013 6:04 AM by Tomaz Cerar

    Accessing static welcome-file

    slrslr Newbie

      Hello,

       

      I deploy an EAR called servlet.ear which contains a servlet war called servlet-example.war, with a context-root "servlet-example:

      Just under servlet-example.war I have

       

      servlet-example.war
      - WEB.INF/web.xml

      - index.html

       

      I want to do a welcome-file, so that accessing http://localhost:8080/servlet-example/ redirects to the index.html page.

      Putting this in web.xml does not work:

       

      <welcome-file-list>

            <welcome-file>index.html</welcome-file>

      </welcome-file-list>

       

      But, redirecting to a servlet works. Example:

          <servlet>

              <servlet-name>HelloWorld</servlet-name>

              <servlet-class>com.ociweb.jboss.example.servlet.HelloWorldServlet</servlet-class>

          </servlet>

       

          <servlet-mapping>

              <servlet-name>HelloWorld</servlet-name>

              <url-pattern>/hello</url-pattern>

          </servlet-mapping>

         

          <welcome-file-list>

            <welcome-file>/hello</welcome-file>

          </welcome-file-list>

       

      With this config, accessing http://localhost:8080/servlet-example/ kind of redirects to http://localhost:8080/servlet-example/hello as expected.

       

      So my question is :

      - Do I place the index.html file at the wrong place ?

      - Is there a config or limitation that prevents accessing static files directly ?

       

      Thank you in advance.

      Cheers,

      Sebastien