protected String getAddressOfEntity()

in software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/nginx/UrlMappingImpl.java [128:154]


    protected String getAddressOfEntity(Entity s) {
        String h = s.getAttribute(Attributes.HOSTNAME);

        Integer p = null;
        Set<String> protos = s.getAttribute(WebAppServiceConstants.ENABLED_PROTOCOLS);
        ProxySslConfig sslConfig = getConfig(SSL_CONFIG);
        if (sslConfig != null && sslConfig.getTargetIsSsl()) {
            // use ssl
            if (protos != null && hasProtocol(protos, "https")) {
                // proto configured correctly
            } else {
                // proto not defined; use https anyway, but it might fail
                log.warn("Misconfiguration for "+this+": ENABLED_PROTOCOLS='"+protos+"' for "+s+" but sslConfig="+sslConfig);
            }
            p = s.getAttribute(Attributes.HTTPS_PORT);
            if (p == null)
                log.warn("Misconfiguration for "+this+": sslConfig="+sslConfig+" but no HTTPS_PORT on "+s);
        }
        if (p == null) {
            // default to http
            p = s.getAttribute(Attributes.HTTP_PORT);
        }

        if (groovyTruth(h) && p != null) return h+":"+p;
        log.error("Unable to construct hostname:port representation for "+s+"; skipping in "+this);
        return null;
    }