File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Referer request without absolute path???? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Referer request without absolute path????" Watch "Referer request without absolute path????" New topic
Author

Referer request without absolute path????

Moined Mogul
Ranch Hand

Joined: Jul 11, 2001
Posts: 33
I would like to be able to do what I have done below in my JSP to prevent someone from book marking the page and then being able to access it without logging in. This works fine as long as I use the absolute path of the URL. Unfortunetly I can not use the absolute path. I can only use the name of the JSP as in First.jsp instead of http://Project...
How can I do the same as I am below but without using the absolute path?
<%
if (request.getHeader("referer").compareToIgnoreCase("http://Project/First.jsp") == 0 | |
request.getHeader("referer").compareToIgnoreCase("http://Project/Second.jsp") == 0 | |
request.getHeader("referer").compareToIgnoreCase("http://Project/Third.jsp") == 0 | |
request.getHeader("referer").compareToIgnoreCase("http://Project/Fourth.jsp") == 0 | |
request.getHeader("referer").compareToIgnoreCase("http://Project.Fifth.jsp") == 0)
{
%>
{
<<THE JSP I WANT TO DISPLAY>>
}
<%
}
else
{
%>
<script language = javascript>
location.href="adminlogin.jsp";
</script>
<%
}
%>
Moined Mogul
Ranch Hand

Joined: Jul 11, 2001
Posts: 33
PLEASE HELP!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Referer request without absolute path????
 
Similar Threads
session.invalidate and jsp form
getHeader("Referer") returns null
reqest.getHeader(Referer) infomation lostin new window
getting the URL for the calling jsp page?
request.getHeader("Referer")