Package org.apache.cxf.transports.http.configuration

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


        for (Iterator it = ep.getPolicy().getAlternatives(); it.hasNext();) {
            Collection<Assertion> as = CastUtils.cast((Collection)it.next(), Assertion.class);
            LOG.fine("Checking alternative with " + as.size() + " assertions.");
            for (Assertion a : as) {
                LOG.fine("Assertion: " + a.getClass().getName());
                HTTPServerPolicy p = (JaxbAssertion.cast(a, HTTPServerPolicy.class)).getData();
                LOG.fine("server policy: " + PolicyUtils.toString(p));
            }
        }

    }
View Full Code Here


        }
        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

     * @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

            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

               
        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.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

        }
        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

    }
   
    @Test
    public void testServerPolicyInServiceModel()
        throws Exception {
        policy = new HTTPServerPolicy();
        address = getEPR("bar/foo");
        bus = new CXFBusImpl();
       
        transportFactory = new JettyHTTPTransportFactory();
       
View Full Code Here

        return setUpDestination(false, false);
    };
   
    private JettyHTTPDestination setUpDestination(boolean contextMatchOnStem, boolean mockedBus)
        throws Exception {
        policy = new HTTPServerPolicy();
        address = getEPR("bar/foo");
        if (!mockedBus) {
            bus = new CXFBusImpl();
        } else {
            bus = EasyMock.createMock(Bus.class);
View Full Code Here

        // for a decoupled endpoint there is no service info
        if (null != engine && engine.isEnabled() && null != endpointInfo.getService()) {
            server = PolicyUtils.getServer(engine, endpointInfo, this);
        }
        if (null == server) {
            server = endpointInfo.getTraversedExtensor(new HTTPServerPolicy(), HTTPServerPolicy.class);
        }
        this.sslServer = endpointInfo.getTraversedExtensor(null, SSLServerPolicy.class);
    }
View Full Code Here

        }
        this.sslServer = endpointInfo.getTraversedExtensor(null, SSLServerPolicy.class);
    }

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

TOP

Related Classes of org.apache.cxf.transports.http.configuration.HTTPServerPolicy

Copyright © 2018 www.massapicom. 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.