Integer hostPort = request.getResourceRef().getHostPort(); if(hostPort == null) hostPort = request.getResourceRef().getSchemeProtocol().getDefaultPort(); String resourcePort = hostPort.toString();
    public float score(Request request, Response response) {        float result = 0F;        String baseDomain = "";        String basePort = "";        String baseScheme = "";        if (request.getBaseRef() != null) {            baseDomain = request.getBaseRef().getHostDomain();            basePort = request.getBaseRef().getHostPort().toString();            baseScheme = request.getBaseRef().getScheme();        }        String resourceDomain = request.getResourceRef().getHostDomain();        String resourcePort = request.getResourceRef().getHostPort().toString();        String resourceScheme = request.getResourceRef().getScheme();        String serverAddress = response.getServerInfo().getAddress();        String serverPort = response.getServerInfo().getPort().toString();        if (Pattern.matches(getHost().getBaseDomain(), baseDomain)                && Pattern.matches(getHost().getBasePort(), basePort)                && Pattern.matches(getHost().getBaseScheme(), baseScheme)                && Pattern.matches(getHost().getResourceDomain(),                        resourceDomain)                && Pattern.matches(getHost().getResourcePort(), resourcePort)                && Pattern.matches(getHost().getResourceScheme(),                        resourceScheme)                && Pattern.matches(getHost().getServerAddress(), serverAddress)                && Pattern.matches(getHost().getServerPort(), serverPort)) {            result = 1F;        }        if (getLogger().isLoggable(Level.FINER)) {            getLogger().finer(                    "Call score for the \"" + getHost().getName() + "\" host: "                            + result);        }        return result;    }