This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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

Win a copy of Building Microservices this week in the Design forum!
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
Have you checked out Aspose?
subject: preventing direct access to html files
It's not a secret anymore!