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
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
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.
精彩评论