You are looking for the "referer" HTTP header (and yes, it is actually mispelled in the protocol itself).
String referrer = request.getHeader("referer");
The returned value will be null if the url is opened directly in the browser and it will contain the full url of the page that was used to navigate to the current page.