Examples of HTTPServerPolicy


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

            && null != endpointInfo.getService()) {
            server = PolicyUtils.getServer(engine, endpointInfo, this);
        }
        if (null == server) {
            server = endpointInfo.getTraversedExtensor(
                    new HTTPServerPolicy(), HTTPServerPolicy.class);
        }
    }
View Full Code Here

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

    }
    private static List<String> createMutableList(String val) {
        return new ArrayList<String>(Arrays.asList(new String[] {val}));
    }
    void setPolicies(Map<String, List<String>> headers) {
        HTTPServerPolicy policy = server;
        if (policy.isSetCacheControl()) {
            headers.put("Cache-Control",
                        createMutableList(policy.getCacheControl().value()));
        }
        if (policy.isSetContentLocation()) {
            headers.put("Content-Location",
                        createMutableList(policy.getContentLocation()));
        }
        if (policy.isSetContentEncoding()) {
            headers.put("Content-Encoding",
                        createMutableList(policy.getContentEncoding()));
        }
        if (policy.isSetContentType()) {
            headers.put(HttpHeaderHelper.CONTENT_TYPE,
                        createMutableList(policy.getContentType()));
        }
        if (policy.isSetServerType()) {
            headers.put("Server",
                        createMutableList(policy.getServerType()));
        }
        if (policy.isSetHonorKeepAlive() && !policy.isHonorKeepAlive()) {
            headers.put("Connection",
                        createMutableList("close"));
        } else if (policy.isSetKeepAliveParameters()) {
            headers.put("Keep-Alive", createMutableList(policy.getKeepAliveParameters()));
        }
       
   
       
    /*
 
View Full Code Here

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

        }
        Collection<Assertion> alternative = new ArrayList<Assertion>();
        for (AssertionInfo ai : ais) {
            alternative.add(ai.getAssertion());
        }
        HTTPServerPolicy compatible = getServer(alternative);
        if (null != compatible && null != confPolicy) {
            if (PolicyUtils.compatible(compatible, confPolicy)) {
                compatible = intersect(compatible, confPolicy);
            } else {
                LogUtils.log(LOG, Level.SEVERE, "INCOMPATIBLE_HTTPSERVERPOLICY_ASSERTIONS");
View Full Code Here

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

     * @return the compatible policy
     * @throws PolicyException if no compatible HTTPServerPolicy can be determined
     */
    public static HTTPServerPolicy getServer(PolicyEngine pe, EndpointInfo ei, Destination d) {
        Collection<Assertion> alternative = pe.getServerEndpointPolicy(ei, d).getChosenAlternative();
        HTTPServerPolicy compatible = null;
        for (Assertion a : alternative) {
            if (HTTPSERVERPOLICY_ASSERTION_QNAME.equals(a.getName())) {
                HTTPServerPolicy p = JaxbAssertion.cast(a, HTTPServerPolicy.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.HTTPServerPolicy

            for (AssertionInfo ai : ais) {
                ai.setAsserted(true);
            }
        } else {
            for (AssertionInfo ai : ais) {
                HTTPServerPolicy p = (JaxbAssertion.cast(ai.getAssertion(),
                                                          HTTPServerPolicy.class)).getData();
                if (equals(p, server)) {
                    ai.setAsserted(true);                
                }
            }
View Full Code Here

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

               
        if (!compatible(p1, p2)) {
            return null;
        }
       
        HTTPServerPolicy p = new HTTPServerPolicy();
        if (p1.isSetCacheControl()) {
            p.setCacheControl(p1.getCacheControl());
        } else if (p2.isSetCacheControl()) {
            p.setCacheControl(p2.getCacheControl());
        }
        p.setContentEncoding(combine(p1.getContentEncoding(), p2.getContentEncoding()));
        p.setContentLocation(combine(p1.getContentLocation(), p2.getContentLocation()));
        if (p1.isSetContentType()) {
            p.setContentType(p1.getContentType());
        } else if (p2.isSetContentType()) {
            p.setContentType(p2.getContentType());
        }    
        if (p1.isSetHonorKeepAlive()) {
            p.setHonorKeepAlive(p1.isHonorKeepAlive());
        } else if (p2.isSetHonorKeepAlive()) {
            p.setHonorKeepAlive(p2.isHonorKeepAlive());
        }
        if (p1.isSetKeepAliveParameters()) {
            p.setKeepAliveParameters(p1.getKeepAliveParameters());
        } else if (p2.isSetKeepAliveParameters()) {
            p.setKeepAliveParameters(p2.getKeepAliveParameters());
        }
       
        if (p1.isSetReceiveTimeout() || p2.isSetReceiveTimeout()) {
            p.setReceiveTimeout(Math.min(p1.getReceiveTimeout(), p2.getReceiveTimeout()));
        }
        p.setRedirectURL(combine(p1.getRedirectURL(), p2.getRedirectURL()));
        p.setServerType(combine(p1.getServerType(), p2.getServerType()));
        if (p1.isSetSuppressClientReceiveErrors()) {
            p.setSuppressClientReceiveErrors(p1.isSuppressClientReceiveErrors());
        } else if (p2.isSetSuppressClientReceiveErrors()) {
            p.setSuppressClientReceiveErrors(p2.isSuppressClientReceiveErrors());
        }
        if (p1.isSetSuppressClientSendErrors()) {
            p.setSuppressClientSendErrors(p1.isSuppressClientSendErrors());
        } else if (p2.isSetSuppressClientSendErrors()) {
            p.setSuppressClientSendErrors(p2.isSuppressClientSendErrors());
        }
       
        return p;
    }
View Full Code Here

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

        }
        return compatible;
    }
   
    private static HTTPServerPolicy getServer(Collection<Assertion> alternative) {     
        HTTPServerPolicy compatible = null;
        for (Assertion a : alternative) {
            if (HTTPSERVERPOLICY_ASSERTION_QNAME.equals(a.getName())) {
                HTTPServerPolicy p = JaxbAssertion.cast(a, HTTPServerPolicy.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.HTTPServerPolicy

            && null != endpointInfo.getService()) {
            server = PolicyUtils.getServer(engine, endpointInfo, this);
        }
        if (null == server && WSDLLibrary.isAvailable()) {
            server = endpointInfo.getTraversedExtensor(
                    new HTTPServerPolicy(), HTTPServerPolicy.class);
        }
    }
View Full Code Here

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

        assertTrue(!PolicyUtils.equals(p1, p2));
    }

    @Test
    public void testCompatibleServerPolicies() {
        HTTPServerPolicy p1 = new HTTPServerPolicy();
        assertTrue("Policy is not compatible with itself.", PolicyUtils.compatible(p1, p1));
        HTTPServerPolicy p2 = new HTTPServerPolicy();
        assertTrue("Policies are not compatible.", PolicyUtils.compatible(p1, p2));
        p1.setServerType("server");
        assertTrue("Policies are not compatible.", PolicyUtils.compatible(p1, p2));
        p1.setServerType(null);
        p1.setReceiveTimeout(10000);
        assertTrue("Policies are not compatible.", PolicyUtils.compatible(p1, p2));
        p1.setSuppressClientSendErrors(false);
        assertTrue("Policies are compatible.", PolicyUtils.compatible(p1, p2));
        p1.setSuppressClientSendErrors(true);
        assertTrue("Policies are compatible.", !PolicyUtils.compatible(p1, p2));
        p2.setSuppressClientSendErrors(true);
        assertTrue("Policies are compatible.", PolicyUtils.compatible(p1, p2));
    }
View Full Code Here

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

        assertTrue("Policies are compatible.", PolicyUtils.compatible(p1, p2));
    }
       
    @Test
    public void testIntersectServerPolicies() {
        HTTPServerPolicy p1 = new HTTPServerPolicy();
        HTTPServerPolicy p2 = new HTTPServerPolicy();
        HTTPServerPolicy p = null;

        p1.setServerType("server");
        p = PolicyUtils.intersect(p1, p2);
        assertEquals("server", p.getServerType());
        p1.setServerType(null);
        p1.setReceiveTimeout(10000L);
        p = PolicyUtils.intersect(p1, p2);
        assertEquals(10000L, p.getReceiveTimeout());
        p1.setSuppressClientSendErrors(true);
        p2.setSuppressClientSendErrors(true);
        p = PolicyUtils.intersect(p1, p2);
        assertTrue(p.isSuppressClientSendErrors());
    }
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.