Exemple #1
0
 protected String getHostIp() {
   try {
     IPAddr localHost = IPAddr.getLocalHost();
     return localHost.getHostAddress();
   } catch (UnknownHostException e) {
     log.error("getHostIp()", e);
     return "1.1.1.1";
   }
 }
 String getLocalIPAddr() {
   if (localAddr == null) {
     try {
       IPAddr localHost = IPAddr.getLocalHost();
       localAddr = localHost.getHostAddress();
     } catch (UnknownHostException e) {
       // shouldn't happen
       log.error("LockssServlet: getLocalHost: " + e.toString());
       return "???";
     }
   }
   return localAddr;
 }