Hello,
I have written a sample servlet which
should get me information about the client.
The code snippet follows:
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException {
ServletOutputStream out = res.getOutputStream();
res.setContentType("text/html");
out.println("<html>\n");
out.println("<title>MyTrialServlet</title>\n<body>Should have va
lues for the client side.<BR>\n");
out.println("Protocol: " + req.getProtocol());
out.println("Servername: " + req.getServerName());
throws ServletException, IOException {
ServletOutputStream out = res.getOutputStream();
res.setContentType("text/html");
out.println("<html>\n");
out.println("<title>MyTrialServlet</title>\n<body>Should have va
lues for the client side.<BR>\n");
out.println("Protocol: " + req.getProtocol());
out.println("Servername: " + req.getServerName());
out.println("User: " +
req.getRemoteUser());
out.println("Host: " + req.getRemoteHost());
out.println("Host: " + req.getRemoteHost());
.........................
From this I am able to get the Protocol, Server IP address but I am not
getting the values for the "Remote User" and "Remote Host" (marked in red). The
value is coming to be "null".
Does anyone know where I am going wrong and how to get
the remore user ?
Thanks in advance.
Regards,
Annu Singh
