Package org.apache.camel.spi

Examples of org.apache.camel.spi.HeaderFilterStrategy.applyFilterToCamelHeaders()


public class CxfRsHeaderFilterStrategyTest extends Assert {
    @Test
    public void testFilterContentType() throws Exception {
        HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("content-type", "just a test", null));
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("Content-Type", "just a test", null));
    }
   
    @Test
    public void testFilterCamelHeaders() throws Exception {
View Full Code Here


public class CxfRsHeaderFilterStrategyTest extends Assert {
    @Test
    public void testFilterContentType() throws Exception {
        HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("content-type", "just a test", null));
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("Content-Type", "just a test", null));
    }
   
    @Test
    public void testFilterCamelHeaders() throws Exception {
        HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
View Full Code Here

    }
   
    @Test
    public void testFilterCamelHeaders() throws Exception {
        HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(Exchange.CHARSET_NAME, "just a test", null));
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, "just a test", null));
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("org.apache.camel.such.Header", "just a test", null));
        assertFalse("Get a wrong filtered result", filter.applyFilterToCamelHeaders("camel.result", "just a test", null));
    }
View Full Code Here

   
    @Test
    public void testFilterCamelHeaders() throws Exception {
        HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(Exchange.CHARSET_NAME, "just a test", null));
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, "just a test", null));
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("org.apache.camel.such.Header", "just a test", null));
        assertFalse("Get a wrong filtered result", filter.applyFilterToCamelHeaders("camel.result", "just a test", null));
    }

}
View Full Code Here

    @Test
    public void testFilterCamelHeaders() throws Exception {
        HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(Exchange.CHARSET_NAME, "just a test", null));
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, "just a test", null));
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("org.apache.camel.such.Header", "just a test", null));
        assertFalse("Get a wrong filtered result", filter.applyFilterToCamelHeaders("camel.result", "just a test", null));
    }

}
View Full Code Here

    public void testFilterCamelHeaders() throws Exception {
        HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(Exchange.CHARSET_NAME, "just a test", null));
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, "just a test", null));
        assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("org.apache.camel.such.Header", "just a test", null));
        assertFalse("Get a wrong filtered result", filter.applyFilterToCamelHeaders("camel.result", "just a test", null));
    }

}
View Full Code Here

    private Map<String, MessageAttributeValue> translateAttributes(Map<String, Object> headers, Exchange exchange) {
        Map<String, MessageAttributeValue> result = new HashMap<String, MessageAttributeValue>();
        HeaderFilterStrategy headerFilterStrategy = getEndpoint().getHeaderFilterStrategy();
        for (Entry<String, Object> entry : headers.entrySet()) {
            // only put the message header which is not filtered into the message attribute
            if (!headerFilterStrategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), exchange)) {
                Object value = entry.getValue();
                if (value instanceof String) {
                    MessageAttributeValue mav = new MessageAttributeValue();
                    mav.setDataType("String");
                    mav.withStringValue((String)value);
View Full Code Here

                    // we should not add headers for the parameters in the uri if we bridge the endpoint
                    // as then we would duplicate headers on both the endpoint uri, and in HTTP headers as well
                    if (skipRequestHeaders != null && skipRequestHeaders.containsKey(key)) {
                        continue;
                    }
                    if (value != null && strategy != null && !strategy.applyFilterToCamelHeaders(key, value, exchange)) {
                        values.add(value);
                    }
                }

                // add the value(s) as a http request header
View Full Code Here

                    // we should not add headers for the parameters in the uri if we bridge the endpoint
                    // as then we would duplicate headers on both the endpoint uri, and in HTTP headers as well
                    if (skipRequestHeaders != null && skipRequestHeaders.containsKey(key)) {
                        continue;
                    }
                    if (value != null && strategy != null && !strategy.applyFilterToCamelHeaders(key, value, exchange)) {
                        values.add(value);
                    }
                }

                // add the value(s) as a http request header
View Full Code Here

        HeaderFilterStrategy strategy = getEndpoint().getHeaderFilterStrategy();

        // propagate headers as HTTP headers
        for (Map.Entry<String, Object> entry : in.getHeaders().entrySet()) {
            String headerValue = in.getHeader(entry.getKey(), String.class);
            if (strategy != null && !strategy.applyFilterToCamelHeaders(entry.getKey(), headerValue, exchange)) {
                httpRequest.addHeader(entry.getKey(), headerValue);
            }
        }

        // lets store the result in the output message.
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.