user1125394
user1125394

Reputation:

glassfish servlet: how to know the referer url? if possible

with the HttpServletRequest object, we can have the getRequestURL, which shows the ressource requested, but in my case I would like to know from where the request comes:

I tried also getRemoteAddr() and getLocalAddr() that prints my local IP, (as I am running glassfish and small webserver that talks to glassfish locally.

but the IP doesn't show the full referer, that should be in my case

http://my.domain.com/wiki/aPage

from my IP I can resolve to http://my.domain.com, yet not the full url

Does this mean I need to send also "wiki/aPage" in the request, or I hope there is a better possibility?

thanks

Upvotes: 0

Views: 383

Answers (1)

UVM
UVM

Reputation: 9914

You can read the Referer header of the request and get the value by using request.getHeader("Referer");

Upvotes: 3

Related Questions