Hello,

We used the below header strategy on the servlet component to allow some
headers.


public class ParameterizedHttpHeaderFilterStrategy extends
DefaultHeaderFilterStrategy {
        private final String[] allowedOutHeaders;

        public ParameterizedHttpHeaderFilterStrategy(String allowedOutHeaders) {
                this.allowedOutHeaders = allowedOutHeaders.split(",");
        }

    protected void initialize() {
        setOutFilter(getParameterizedOutFilter());
        
        setLowerCase(true);
        
        // filter headers begin with "Camel" or "org.apache.camel"
        // must ignore case for Http based transports
       
setOutFilterPattern("(?i)(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
    }

        protected Set<String> getParameterizedOutFilter() {
                Set<String> outFilter = new HashSet<String>();
                outFilter.add("content-length");
                outFilter.add("content-type");
                outFilter.add("host");
                // Add the filter for the Generic Message header
                // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
                outFilter.add("cache-control");
                outFilter.add("connection");
                outFilter.add("date");
                outFilter.add("pragma");
                outFilter.add("trailer");
                outFilter.add("transfer-encoding");
                outFilter.add("upgrade");
                outFilter.add("via");
                outFilter.add("warning");
                
                for(String allowedOutHeader: allowedOutHeaders){
                        outFilter.remove(allowedOutHeader.toLowerCase());
                }
                
                return outFilter;
        }
}


Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/Cacehe-Controle-header-tp5764045p5764220.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to