I am building a simple webapp using Java Servlets 3.1.0.
Is there a way in which I can prevent access to pages in my WEB-INF directly via the URL?
For example:
I have the file dashboard.jsp
in my WEB-INF
folder. I also have a servlet called the DashboardServlet
that is accessible using /dashbboard
in which I use the RequestDispatcher
to forward dashboard.jsp
So now, when I access localhost:8080/dashboard
, dashboard.jsp
is shown.
However, the dashboard is also shown when I try to access localhost:8080/dashboard.jsp
How can I prevent access to localhost:8080/dashboard.jsp
while still making the foward on localhost:8080/dashboard
possible.
Thanks!