Get URL of the request sender with HttpServletRequest
To get the source domain you can use request.getHeader("origin")
especially if the requests have to pass through a proxy server.
You could do either
// gets client (browser)'s hostname
String host = request.getRemoteHost();
OR
// get the server's domain name.
String domain = new URL(request.getRequestURL().toString()).getHost();