Get the Remote address.
@return the remote host name
181135
public String getRemoteHost()
    {
        if (_remoteHost==null)
        {
            if (_resolveRemoteHost)
            {
                if (_remoteInetAddress==null)
                    return "localhost";
                _remoteHost=_remoteInetAddress.getHostName();
            }
            else
            {
                if (_remoteInetAddress==null)
                    return "127.0.0.1";
                _remoteHost=getRemoteAddr();
            }
        }
        return _remoteHost;
    }
1241899
private String getHostname(){
		String hostname = null;
        try {
            // Use the OS hostname first.
            hostname = InetAddress.getLocalHost().getHostName().toLowerCase();
        } catch (UnknownHostException e) {
            logger.warn("Cannot find hostname.", e);
        }
        // Override by a system property second. Sometimes set when running in a container. 
        String hostnameOverride = System.getProperty(hostnamePropertyName);
        if (hostnameOverride != null && hostnameOverride.length() > 0){
        	hostname = hostnameOverride;
            logger.info("Overriden hostname '{}' defined in system property '{}' will be used to choose Spring profile", hostname, hostnamePropertyName);
        }else{
        	hostnameOverride = System.getenv(hostnamePropertyName.toUpperCase());
            if (hostnameOverride != null && hostnameOverride.length() > 0){
            	hostname = hostnameOverride;
                logger.info("Overriden hostname '{}' defined in environment variable '{}' will be used to choose Spring profile", hostname, hostnamePropertyName.toUpperCase());
            }else{
                logger.info("The hostname '{}' will be used to choose Spring profile", hostname);
            }
        }
        
        String subHostnameOverride = System.getProperty(subHostnamePropertyName);
        if (subHostnameOverride != null && subHostnameOverride.length() > 0){
        	hostname += "/" + subHostnameOverride;
            logger.info("Sub-hostname defined in system property '{}' appended. The full hostname that will be used to choose Spring profile is: {}", subHostnamePropertyName, hostname);
        }else{
        	subHostnameOverride = System.getenv(subHostnamePropertyName.toUpperCase());
            if (subHostnameOverride != null && subHostnameOverride.length() > 0){
            	hostname += "/" + subHostnameOverride;
                logger.info("Sub-hostname defined in environment variable '{}' appended. The full hostname that will be used to choose Spring profile is: {}", subHostnamePropertyName.toUpperCase(), hostname);
            }
        }

        return hostname;
	}
300173
public InetSocketAddress getRemoteAddressUDP () {
		InetSocketAddress connectedAddress = udp.connectedAddress;
		if (connectedAddress != null) return connectedAddress;
		return udpRemoteAddress;
	}
337533
public InetSocketAddress getRemoteAddress()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getRemoteAddress");
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getRemoteAddress","rc="+remoteAddress);
      return remoteAddress;
   }
128008
public String getRemoteAddr()
    {
        String addr = "127.0.0.1";
        HttpConnection connection = getHttpConnection();
        if (connection != null)
        {
            addr = connection.getRemoteAddr();
            if (addr == null) addr = connection.getRemoteHost();
        }
        return addr;
    }
1025797
private static String getHostName() {
    String hostName = null;
    try {
      hostName = InetAddress.getLocalHost().getHostName();
    } 
    catch (UnknownHostException ex) {
      LOG.info("Unable to obtain hostName", ex);
      hostName = "unknown";
    }
    return hostName;
  }
176872
public InetAddress getInetAddress() throws UnknownHostException{
     if(ip!=null) return ip;

     return (ip=InetAddress.getByName(host));
   }
676784
private static String getHostname() {
        if (Hostname == null) {
            try {
                Hostname = InetAddress.getLocalHost().getHostName();
            } catch (Exception e) {
                Hostname = "default";
                LOGGER.warn("Can not get current hostname", e);
            }
        }
        return Hostname;
    }
1170305
public static String getRemoteAddress() {
    InetAddress addr = getRemoteIp();
    return (addr == null) ? null : addr.getHostAddress();
  }
474389
public String getHost() {
        String hostAndPort = hostAndPort();
        int indexOfMaohao = hostAndPort.indexOf(":");
        if (indexOfMaohao == -1) {
            return hostAndPort;
        } else {
            return hostAndPort.substring(0, indexOfMaohao);
        }
    }
408109
public String getAppServerName()
    {
        String strServer = this.getProperty(Params.REMOTE_HOST);
        if ((strServer == null) || (strServer.length() == 0))
        {
            URL urlCodeBase = this.getCodeBase();
            if (urlCodeBase != null)
            {
                strServer = urlCodeBase.getHost();
                int port = urlCodeBase.getPort();
                if ((port != -1) && (port != 80))
                    if (!strServer.contains(":"))
                        strServer = strServer + ':' + port;
            }
        }
        return strServer;
    }
1005800
private String getTargetHost() {
        String host = getVirtualHost();
        if (null == host) {
            host = (isIncoming()) ? getServiceContext().getLocalAddr().getCanonicalHostName() : getServiceContext().getRemoteAddr().getCanonicalHostName();
        }
        return host;
    }
1270817
public String getRemoteAddr()
    {
        if (_remoteAddr==null)
        {
            if (_remoteInetAddress==null)
                return "127.0.0.1";
            _remoteAddr=_remoteInetAddress.getHostAddress();
        }
        return _remoteAddr;
    }
1301934
public static String getLocalhost() {
    if (localhost == null) {
      synchronized (HostAndPort.class) {
        if (localhost == null) {
          return localhost = getLocalHostQuietly();
        }
      }
    }
    return localhost;
  }
712700
public java.lang.String getHostname() {
    java.lang.Object ref = hostname_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (bs.isValidUtf8()) {
        hostname_ = s;
      }
      return s;
    }
  }
1130949
public static String getHostName(SocketAddress socketAddress) {
        if (socketAddress == null) {
            return null;
        }

        if (socketAddress instanceof InetSocketAddress) {
            InetAddress addr = ((InetSocketAddress) socketAddress).getAddress();
            if(addr != null){
                return addr.getHostAddress();
            }
        }

        return null;
    }
1224246
public String getHost()
    {
        // Return already determined host
        if (_host != null) return _host;

        // Return host from absolute URI
        _host = _uri.getHost();
        _port = _uri.getPort();
        if (_host != null) return _host;

        // Return host from header field
        _hostPort = _header.get(HttpFields.__Host);
        _host = _hostPort;
        _port = 0;
        if (_host != null && _host.length() > 0)
        {
            int colon = _host.lastIndexOf(':');
            if (colon >= 0)
            {
                if (colon < _host.length())
                {
                    try
                    {
                        _port = TypeUtil.parseInt(_host, colon + 1, -1, 10);
                    }
                    catch (Exception e)
                    {
                        LogSupport.ignore(log, e);
                    }
                }
                _host = _host.substring(0, colon);
            }

            return _host;
        }

        // Return host from connection
        if (_connection != null)
        {
            _host = _connection.getServerName();
            _port = _connection.getServerPort();
            if (_host != null && !InetAddrPort.__0_0_0_0.equals(_host)) return _host;
        }

        // Return the local host
        try
        {
            _host = InetAddress.getLocalHost().getHostAddress();
        }
        catch (java.net.UnknownHostException e)
        {
            LogSupport.ignore(log, e);
        }
        return _host;
    }