org.ow2.jonas.lib.util
Class NetUtils

java.lang.Object
  extended by org.ow2.jonas.lib.util.NetUtils

public class NetUtils
extends Object

NetUtils is meant to provide routine network related information to components of JONAS. One of the main purposes is to allow the server to extract it's own IP address correctly. This addresses a bug in java when dealing with Linux boxes on DHCP trying to extract their own IP addresses and always getting the loop back address instead of the external one.

Author:
Vivek Lakshmanan

Field Summary
static String LOOP_BACK_ADDR
          IPv4 Loop back address.
 
Constructor Summary
NetUtils()
           
 
Method Summary
static String getLocalAddress()
          Get the string form of the local IP address and not naively assume InetAddress.getLocalHost().getHostAddress() is the correct value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOOP_BACK_ADDR

public static final String LOOP_BACK_ADDR
IPv4 Loop back address.

See Also:
Constant Field Values
Constructor Detail

NetUtils

public NetUtils()
Method Detail

getLocalAddress

public static String getLocalAddress()
                              throws UnknownHostException
Get the string form of the local IP address and not naively assume InetAddress.getLocalHost().getHostAddress() is the correct value. See the class description above for details.

Returns:
A string representing the IPv4 localhost IP address.
Throws:
UnknownHostException


Copyright © 2010 OW2 Consortium. All Rights Reserved.