How to get the referer url in Java?
You can use the following line of code in your Servlet or JSP page:
String referrer = request.getHeader("referer"); System.out.println("referrer: " + referrer);
To get the referer url in Java you can use the getHeader() method of HttpServletRequest interface. The argument of this method, in this case, must be a String "referer" like as
String refererUrl = request.getHeader("referer");
For detail tutorial please go through the link given below may this will be helpful for you.