Frage

What is the best way to achieve this ? I have a tomcat server and the files are uploaded to the WEB-INF folder and I used to write a html file (index.html) and add the files manually. I enabled directory listing in Tomcat but when I type in http://127.0.0.1/test_server/WEB-INF/ I get a 404 , if I move the files to test_server instead of WEB-INF and if I go to http://127.0.0.1/test_server/ The file gets listed there so how do I get it to work when I navigate to WEB-INF folder ?

War es hilfreich?

Lösung

"TheWEB-INF directory is not part of the public document tree of the application. No file contained in theWEB-INF directory can be served directly to a client by the container. However, the contents of theWEB-INF directory are visible to servlet code using the getResource and getResourceAsStream() method calls onthe ServletContextorincludes/forwardsusingthe RequestDispatcher."

More explanation ca be found here: http://docs.oracle.com/cd/E11035_01/wls100/webapp/configurewebapp.html

So you should use a different directory if you want to enable directory listing.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top