tags:

views:

35

answers:

2

Hi,

How protect resouces from outside access in the Web application using jsp - spring ?

e.g. http://localhost:8080/appsname/images/ here showing list of files

here i dont want to users to direct access to my image folder.if any one trying to do then redirect to error page or home page.

Thanks

+2  A: 

Usually this is achieved by configuring your webserver to disallow directory browsing on a particular directory. For example, using the apache webserver, you'd use Options -Indexes

mopoke
+1  A: 

The way to do it is to store the images somewhere outside the web container (Tomcat?) like in /opt/data/webapp_name/images/ and write a controller that retrieves the images from that locations. Thus there is no direct access to the images and all kinds of security logic can be added to the controller.

kosoant