Reputation: 23
I want to get the domain names who are accessing my application. I tried with :getHostName(),getServerName()... All gives the the domain of the Server, not the cient, I want to get domain name of client..
Upvotes: 2
Views: 6246
Reputation: 181
You can inject HttpServletRequest in your controller's method and use
@GetMapping("/getInfo")
public void getRemoteHost(HttpServletRequest request,...) {
System.out.println("=========> "+request.getRemoteAddr());
}
Upvotes: 2