What if I have three machines behind a load balancer with a single VIP address. 
Does this get me the IP address of the server I am actually running on?

>>> David Sean Taylor <[EMAIL PROTECTED]> 7/30/2008 11:01 AM >>>

On Jul 30, 2008, at 8:51 AM, Dan Olsen wrote:

> Is there a way I can grab the IP address of the machine that  
> jetspeed is running on. I need it for a portlet I am writing so we  
> know which machine we are running from.
>

Try out this JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
     pageEncoding="ISO-8859-1"%>
<%@ page import="java.net.InetAddress"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd 
">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
String hostName = request.getServerName();
InetAddress inet = InetAddress.getByName(hostName);
out.println ("IP  : " + inet.getHostAddress());
%>
</body>
</html>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 

Reply via email to