public boolean compatible()

in rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/impl/ClientPolicyCalculator.java [166:250]


    public boolean compatible(HTTPClientPolicy p1, HTTPClientPolicy p2) {

        if (p1 == p2 || p1.equals(p2)) {
            return true;
        }

        boolean compatible = true;

        if (compatible) {
            compatible &= StringUtils.compatible(p1.getAccept(), p2.getAccept());
        }

        if (compatible) {
            compatible &= StringUtils.compatible(p1.getAcceptEncoding(), p2.getAcceptEncoding());
        }

        if (compatible) {
            compatible &= StringUtils.compatible(p1.getAcceptLanguage(), p2.getAcceptLanguage());
        }

        if (compatible) {
            compatible &= StringUtils.compatible(p1.getBrowserType(), p2.getBrowserType());
        }

        if (compatible) {
            compatible &= !p1.isSetCacheControl() || !p2.isSetCacheControl()
                          || p1.getCacheControl().equals(p2.getCacheControl());
        }

        if (compatible) {
            compatible = !p1.isSetConnection() || !p2.isSetConnection()
                         || p1.getConnection().value().equals(p2.getConnection().value());
        }

        if (compatible) {
            compatible = !p1.isSetContentType() || !p2.isSetContentType()
                         || p1.getContentType().equals(p2.getContentType());
        }

        if (compatible) {
            compatible &= StringUtils.compatible(p1.getCookie(), p2.getCookie());
        }

        // REVISIT: Should compatibility require strict equality?

        if (compatible) {
            compatible &= StringUtils.compatible(p1.getDecoupledEndpoint(), p2.getDecoupledEndpoint());
        }

        if (compatible) {
            compatible &= StringUtils.compatible(p1.getHost(), p2.getHost());
        }

        if (compatible) {
            compatible &= StringUtils.compatible(p1.getProxyServer(), p2.getProxyServer());
        }

        if (compatible) {
            compatible &= !p1.isSetProxyServerPort() || !p2.isSetProxyServerPort()
                          || p1.getProxyServerPort().equals(p2.getProxyServerPort());
        }

        if (compatible) {
            compatible &= !p1.isSetProxyServerType() || !p2.isSetProxyServerType()
                          || p1.getProxyServerType().equals(p2.getProxyServerType());
        }

        if (compatible) {
            compatible &= StringUtils.compatible(p1.getReferer(), p2.getReferer());
        }

        if (compatible) {
            compatible &= !p1.isSetAllowChunking()
                || !p2.isSetAllowChunking()
                || p1.isAllowChunking() == p2.isAllowChunking();
        }

        if (compatible) {
            compatible &= !p1.isSetAutoRedirect()
                || !p2.isSetAutoRedirect()
                || p1.isAutoRedirect() == p2.isAutoRedirect();
        }

        return compatible;
    }