ibro
asked on
Computer (host) name in Java (JSP page)
Hi everyone,
I want to retrieve a computer (host) name of the machine in Java on WinNT based intranet. The Java code is implemented in class, which works on JRun application server JSP (server-side).
To make myself clear I want to get the computer (host) name of the client machine, that made the request, in class, implemented in JSP page, that works in application server. (hmmm, what a sentance...). I don't want to store the IP addresses of the clients, becasuse they are dynamic.
Hope I expressed my self clear.
Thanks in advance.
I want to retrieve a computer (host) name of the machine in Java on WinNT based intranet. The Java code is implemented in class, which works on JRun application server JSP (server-side).
To make myself clear I want to get the computer (host) name of the client machine, that made the request, in class, implemented in JSP page, that works in application server. (hmmm, what a sentance...). I don't want to store the IP addresses of the clients, becasuse they are dynamic.
Hope I expressed my self clear.
Thanks in advance.
ASKER
TimYates, this does not work. It returns the same as request.getRemoteAddr() - i.e. the IP address.
try
following code
<%
try
{
String hName = InetAddress.getByName(requ est.getRem oteHost()) .getHostNa me();
}
catch(Exception dd)
{
dd.printStackTrace();
}
%>
cheers
RJ
following code
<%
try
{
String hName = InetAddress.getByName(requ
}
catch(Exception dd)
{
dd.printStackTrace();
}
%>
cheers
RJ
ASKER
rjackman, I get the same result as request.getHostName().
There is something that I forgot to mention, there is firewall in the intranet, so all requests to application server appear to come from the firewalls IP address.
The firewall is on a different network (I can ping it, but I can not access it using the hostname).
I wonder is it possible to get the computer name in this case?
There is something that I forgot to mention, there is firewall in the intranet, so all requests to application server appear to come from the firewalls IP address.
The firewall is on a different network (I can ping it, but I can not access it using the hostname).
I wonder is it possible to get the computer name in this case?
ASKER
rjackman, I get the same result as request.getHostName().
There is something that I forgot to mention, there is firewall in the intranet, so all requests to application server appear to come from the firewalls IP address.
The firewall is on a different network (I can ping it, but I can not access it using the hostname).
I wonder is it possible to get the computer name in this case?
There is something that I forgot to mention, there is firewall in the intranet, so all requests to application server appear to come from the firewalls IP address.
The firewall is on a different network (I can ping it, but I can not access it using the hostname).
I wonder is it possible to get the computer name in this case?
Probably not... :-(
It should be possible by using either signmed applet or signed javascript.
ASKER
Unfortunately I can not use signed applet, and javascript is not working for me. I need the host name on server side before page is sent to client.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think TihYates deserves the points.
Thanks guys!
Thanks guys!
<%
String hostname = request.getRemoteHost() ;
%>
Good Luck,
Tim.