5

I have a JSP web application project StudentApp and I configured in my server.xml as follows

< Host name="test.com" appBase="D:/StudentApp" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> Context path="" reloadable="true" crossContext="true" > /Context> /Host>

When I started my application it is running fine. I have kept some folders in D:/StudentApp like properties,ROOT,svn and I can access all folders from my site.
For example I can access like test.com/properties etc..if I give this path correctly. I want to restrict only with ROOT folder..Have anybody came across with same type of issue? How can I make this?

Hulk1991
  • 3,079
  • 13
  • 31
  • 46
Alex
  • 790
  • 1
  • 7
  • 22

2 Answers2

0

As per the standard for web applciations, everything under the AppBase(except WEB-INF) is visible to the browser(if browsing directory is enabled or use types the full url of the file). So, if you do not want users to access those files, they HAVE to go under WEB-INF

user1226320
  • 413
  • 1
  • 4
  • 11
0

You have two options:

  1. Develop a filter in you web application so every request must be checked before processing to your application.
  2. Use tomcat Valve feature and develop a Valve so can narrow the request to only ROOT folder

Unless you can find a ready-to-use Valve, I recommend the first one.

Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173