File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes preventing direct access to html files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "preventing direct access to html files" Watch "preventing direct access to html files" New topic

preventing direct access to html files

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 418
In my application, i am redirecting my control to a html file using response.sendRedirect(). Once this is done, that html file is freely accessible even if the url is copy-pasted into other browser. Is there any way that we can find out if client is trying to access that file directly.
I cannot put file inside web-inf,because response.sendRedirect() is not authorised to redirect control to files inside web-inf.
Any suggestions.
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

You can write a servlet which will send content of your html file to the client end.
[ December 15, 2008: Message edited by: Himanshu Gupta ]

My Blog SCJP 5 SCWCD 5
I agree. Here's the link:
subject: preventing direct access to html files
It's not a secret anymore!