Examples of HTTPClientPolicy


Examples of org.apache.cxf.transports.http.configuration.HTTPClientPolicy

     * @return the compatible policy
     * @throws PolicyException if no compatible HTTPClientPolicy can be determined
     */
    public static HTTPClientPolicy getClient(PolicyEngine pe, EndpointInfo ei, Conduit c) {
        Collection<PolicyAssertion> alternative = pe.getClientEndpointPolicy(ei, c).getChosenAlternative();
        HTTPClientPolicy compatible = null;
        for (PolicyAssertion a : alternative) {
            if (HTTPCLIENTPOLICY_ASSERTION_QNAME.equals(a.getName())) {
                HTTPClientPolicy p = JaxbAssertion.cast(a, HTTPClientPolicy.class).getData();
                if (null == compatible) {
                    compatible = p;
                } else {
                    compatible = intersect(compatible, p);
                    if (null == compatible) {
View Full Code Here

Examples of org.apache.cxf.transports.http.configuration.HTTPClientPolicy

     * client policy.
     * @param message the current message
     * @param client the client policy
     */
    public static void assertClientPolicy(Message message, HTTPClientPolicy client) {
        HTTPClientPolicy pol = message.get(HTTPClientPolicy.class);
        if (pol != null) {
            client = intersect(pol, client);
        }

        AssertionInfoMap aim = message.get(AssertionInfoMap.class);
        if (null == aim) {
            return;
        }
        Collection<AssertionInfo> ais = aim.get(HTTPCLIENTPOLICY_ASSERTION_QNAME);         
        if (null == ais || ais.size() == 0) {
            return;
        }  
       
        // assert all assertion(s) that are compatible with the value configured for the conduit
       
        if (MessageUtils.isOutbound(message)) {                       
            for (AssertionInfo ai : ais) {
                HTTPClientPolicy p = (JaxbAssertion.cast(ai.getAssertion(),
                                                          HTTPClientPolicy.class)).getData();
                if (compatible(p, client)) {
                    ai.setAsserted(true);
                }
            }
View Full Code Here

Examples of org.apache.cxf.transports.http.configuration.HTTPClientPolicy

            return null;
        }
       
        // ok - compute compatible policy
       
        HTTPClientPolicy p = new HTTPClientPolicy();
        p.setAccept(combine(p1.getAccept(), p2.getAccept()));
        p.setAcceptEncoding(combine(p1.getAcceptEncoding(), p2.getAcceptEncoding()));
        p.setAcceptLanguage(combine(p1.getAcceptLanguage(), p2.getAcceptLanguage()));
        if (p1.isSetAllowChunking()) {
            p.setAllowChunking(p1.isAllowChunking());
        } else if (p2.isSetAllowChunking()) {
            p.setAllowChunking(p2.isAllowChunking());
        }
        if (p1.isSetAutoRedirect()) {
            p.setAutoRedirect(p1.isAutoRedirect());
        } else if (p2.isSetAutoRedirect()) {
            p.setAutoRedirect(p2.isAutoRedirect());
        }
        p.setBrowserType(combine(p1.getBrowserType(), p2.getBrowserType()));
        if (p1.isSetCacheControl()) {
            p.setCacheControl(p1.getCacheControl());
        } else if (p2.isSetCacheControl()) {
            p.setCacheControl(p2.getCacheControl());
        }
        if (p1.isSetConnection()) {
            p.setConnection(p1.getConnection());
        } else if (p2.isSetConnection()) {
            p.setConnection(p2.getConnection());
        }       
        if (p1.isSetContentType()) {
            p.setContentType(p1.getContentType());
        } else if (p2.isSetContentType()) {
            p.setContentType(p2.getContentType());           
        }
        p.setCookie(combine(p1.getCookie(), p2.getCookie()));
        p.setDecoupledEndpoint(combine(p1.getDecoupledEndpoint(), p2.getDecoupledEndpoint()));
        p.setHost(combine(p1.getHost(), p2.getHost()));
        p.setProxyServer(combine(p1.getProxyServer(), p2.getProxyServer()));
        if (p1.isSetProxyServerPort()) {
            p.setProxyServerPort(p1.getProxyServerPort());
        } else if (p2.isSetProxyServerPort()) {
            p.setProxyServerPort(p2.getProxyServerPort());
        }
        if (p1.isSetProxyServerType()) {
            p.setProxyServerType(p1.getProxyServerType());
        } else if (p2.isSetProxyServerType()) {
            p.setProxyServerType(p2.getProxyServerType());
        }
        p.setReferer(combine(p1.getReferer(), p2.getReferer()));
        if (p1.isSetConnectionTimeout() || p2.isSetConnectionTimeout()) {
            p.setConnectionTimeout(Math.min(p1.getConnectionTimeout(), p2.getConnectionTimeout()));
        }
        if (p1.isSetReceiveTimeout() || p2.isSetReceiveTimeout()) {
            p.setReceiveTimeout(Math.min(p1.getReceiveTimeout(), p2.getReceiveTimeout()));
        }
        
        return p;     
    }
View Full Code Here

Examples of org.apache.cxf.transports.http.configuration.HTTPClientPolicy

    private static boolean compatible(String s1, String s2) {
        return s1 == null || s2 == null || s1.equals(s2);
    }
   
    private static HTTPClientPolicy getClient(Collection<PolicyAssertion> alternative) {     
        HTTPClientPolicy compatible = null;
        for (PolicyAssertion a : alternative) {
            if (HTTPCLIENTPOLICY_ASSERTION_QNAME.equals(a.getName())) {
                HTTPClientPolicy p = JaxbAssertion.cast(a, HTTPClientPolicy.class).getData();
                if (null == compatible) {
                    compatible = p;
                } else {
                    compatible = intersect(compatible, p);
                    if (null == compatible) {
View Full Code Here

Examples of org.apache.cxf.transports.http.configuration.HTTPClientPolicy

    private void verifyBethalClient(Greeter bethal) {
        Client client = ClientProxy.getClient(bethal);
        HTTPConduit http =
            (HTTPConduit) client.getConduit();
       
        HTTPClientPolicy httpClientPolicy = http.getClient();
        assertEquals("the httpClientPolicy's autoRedirect should be true",
                     true, httpClientPolicy.isAutoRedirect());
        TLSClientParameters tlsParameters = http.getTlsClientParameters();
        assertNotNull("the http conduit's tlsParameters should not be null", tlsParameters);
       
       
        // If we set any name, but Edward, Mary, or George,
View Full Code Here

Examples of org.apache.cxf.transports.http.configuration.HTTPClientPolicy

        // This also tests dynamic configuration of the conduit.
        Client client = ClientProxy.getClient(bethal);
        HTTPConduit http =
            (HTTPConduit) client.getConduit();
       
        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
       
        httpClientPolicy.setAutoRedirect(false);
        // If we set any name, but Edward, Mary, or George,
        // and a password of "password" we will get through
        // Bethal.
        AuthorizationPolicy authPolicy = new AuthorizationPolicy();
        authPolicy.setUserName("Betty");
View Full Code Here

Examples of org.apache.cxf.transports.http.configuration.HTTPClientPolicy

        // This also tests dynamic configuration of the conduit.
        Client client = ClientProxy.getClient(poltim);
        HTTPConduit http =
            (HTTPConduit) client.getConduit();
       
        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
       
        httpClientPolicy.setAutoRedirect(true);
       
        http.setClient(httpClientPolicy);
        http.setTlsClientParameters(tlsClientParameters);
        poltim.sayHi();
    }
View Full Code Here

Examples of org.apache.cxf.transports.http.configuration.HTTPClientPolicy

        // This also tests dynamic configuration of the conduit.
        Client client = ClientProxy.getClient(bethal);
        HTTPConduit http =
            (HTTPConduit) client.getConduit();
       
        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
       
        httpClientPolicy.setAutoRedirect(false);
        // If we set any name, but Edward, Mary, or George,
        // and a password of "password" we will get through
        // Bethal.
        AuthorizationPolicy authPolicy = new AuthorizationPolicy();
        authPolicy.setUserName("Betty");
View Full Code Here

Examples of org.apache.cxf.transports.http.configuration.HTTPClientPolicy

        // This also tests dynamic configuration of the conduit.
        Client client = ClientProxy.getClient(tarpin);
        HTTPConduit http =
            (HTTPConduit) client.getConduit();
       
        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
       
        httpClientPolicy.setAutoRedirect(true);
        // If we set any name, but Edward, Mary, or George,
        // and a password of "password" we will get through
        // Bethal.
        AuthorizationPolicy authPolicy = new AuthorizationPolicy();
        authPolicy.setUserName("Betty");
View Full Code Here

Examples of org.apache.cxf.transports.http.configuration.HTTPClientPolicy

        // This also tests dynamic configuration of the conduit.
        Client client = ClientProxy.getClient(gordy);
        HTTPConduit http =
            (HTTPConduit) client.getConduit();
       
        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
       
        httpClientPolicy.setAutoRedirect(true);
        http.setClient(httpClientPolicy);
        http.setTlsClientParameters(tlsClientParameters);
       
        // We get redirected from Gordy, to Bethal.
        http.setTrustDecider(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.