protected String getHostHeader() {
        if (m_hostHeader != null) {
            return m_hostHeader;
        }

        if (!httpAdminListener.m_publicIntf.isEmpty()) {
            m_hostHeader = httpAdminListener.m_publicIntf;
            return m_hostHeader;
        }

        InetAddress addr = null;
        int httpPort = VoltDB.DEFAULT_HTTP_PORT;
        try {
            String localMetadata = VoltDB.instance().getLocalMetadata();
            JSONObject jsObj = new JSONObject(localMetadata);
            JSONArray interfaces = jsObj.getJSONArray("interfaces");
            //The first interface is external interface if specified.
            String iface = interfaces.getString(0);
            addr = InetAddress.getByName(iface);
            httpPort = jsObj.getInt("httpPort");
        } catch (Exception e) {
            m_log.warn("Failed to get HTTP interface information.", e);
        }
        if (addr == null) {
            addr = org.voltcore.utils.CoreUtils.getLocalAddress();
        }
        //Make the header string.
        m_hostHeader = addr.getHostAddress() + ":" + httpPort;
        return m_hostHeader;
    }
protected String getHostHeader ( ) { if ( m_hostHeader != null ) { return m_hostHeader ; } if ( ! httpAdminListener . m_publicIntf . isEmpty ( ) ) { m_hostHeader = httpAdminListener . m_publicIntf ; return m_hostHeader ; } InetAddress addr = null ; int httpPort = VoltDB . DEFAULT_HTTP_PORT ; try { String localMetadata = VoltDB . instance ( ) . getLocalMetadata ( ) ; JSONObject jsObj = new JSONObject ( localMetadata ) ; JSONArray interfaces = jsObj . getJSONArray ( "interfaces" ) ; String iface = interfaces . getString ( 0 ) ; addr = InetAddress . getByName ( iface ) ; httpPort = jsObj . getInt ( "httpPort" ) ; } catch ( Exception e ) { m_log . warn ( "Failed to get HTTP interface information." , e ) ; } if ( addr == null ) { addr = org . voltcore . utils . CoreUtils . getLocalAddress ( ) ; } m_hostHeader = addr . getHostAddress ( ) + ":" + httpPort ; return m_hostHeader ; }
like behind a NATed network.