Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent Hot linking to servlets

Status
Not open for further replies.

timesign

Programmer
May 7, 2002
53
US
Is there a way to prevent other sites from hotlinking to your servlet?
My servlet serves files and I don't want it to be called from another website.
Thanks
 
Using the HttpServletRequest and ServletRequest objects, there are methods to determine the "forwarding" URL, and IP and machine name (I forget the precise methods, but take a look at the API docs) - so you could test these - if they are not yours, then dump the request.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top