This discussion is archived
2 Replies Latest reply: Jul 19, 2012 12:53 AM by gimbal2 RSS

Accessing list of client window login name from server in JAVA

950459 Newbie
Currently Being Moderated
how to get the client windows login name in server using JAVA those who access the site?
I used the following code, but im getting only local machine name . getRemoteUser() is returning null value. I am using tomcat server.
Is there anything to do with windows IIS configuration??
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String clientIP = request.getRemoteAddr();
//
// Get client's host name
//
String clintHost = request.getRemoteHost();
String user = request.getRemoteUser();
String computerName = InetAddress.getLocalHost().getHostName();
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
out.println("IP : " + clientIP);
out.println("Host: " + clintHost);
out.println("Remote User: "+user);
out.println("Local User: "+ computerName);

}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points