I am trying to write a java code that will return the name of the machine on which it is running as in the name of the remote machine from which I am accessing the code instead of the machine where it is actually running. I have this code but it returns the name of parent machine in output instead of the remote machine:
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter();
String remoteUser = req.getRemoteUser();
}
This code is on a system with name : Animesh I am trying to access the code through another machine named: Bhaskar using the system's IP address as in :8080/website/home
I am expecting it to return Bhaskar as username but it returns Animesh instead