How to stop the directory structure from being viewed in J2EE applications

in a J2EE application, if the user explicitly displays the name of the destination page, then what is the best way to not show the directory structure?

Example:

/mycoolapp/somefolder/test.jsp

/mycoolapp/somefolder/  -- this will show all the files under 'somefolder'

What is the best way to redirect or show the user a page that says, "Not where you belong." I want to avoid providing index.jsp in all folders / subfolders of my application.

The GlassFish application server is used. The application also uses the Struts2 framework, although not all code is in struts2. Some code uses traditional servlets

+3
source share
1 answer

, GlassFish , , , GF. , , , , J2EE Java EE.

AS9/Glassfish - web.xml. :

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

"True" "False".

: http://www.google.com/search?q=glassfish+disable+directory+listing

: http://blogs.oracle.com/bounds/entry/turning_off_directory_listings_in

+8

Source: https://habr.com/ru/post/1738518/


All Articles