I have a angular application, which is making a rest call as:
http://localhost:8765/test/iptest
And in my controller :
@GetMapping(value = "test/iptest")
public ResponseEntity<Object> doTest() {
log.debug("Inside Test");
return new ResponseEntity<>("Test success", HttpStatus.OK);
}
How do I access client's IP and MAC address using this request?
EDIT:
I was able to access Client's IP Address using HttpServletRequest as:
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Context;
@GetMapping(value = "test/iptest")
public ResponseEntity<Object> doTest(@Context HttpServletRequest request) {
log.debug("IP Address is:"+request.getRemoteAddr());
return new ResponseEntity<>("Test success", HttpStatus.OK);
}
But I'm not able to access MAC ADDRESS
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…