001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.camel.component.http;
018    
019    import org.apache.camel.impl.DefaultHeaderFilterStrategy;
020    
021    /**
022     * @version $Revision: 932690 $
023     */
024    public class HttpHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
025        
026        public HttpHeaderFilterStrategy() {
027            initialize();  
028        }
029    
030        protected void initialize() {
031            getOutFilter().add("content-length");
032            getOutFilter().add("content-type");
033            // Add the filter for the Generic Message header
034            // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
035            getOutFilter().add("cache-control");
036            getOutFilter().add("connection");
037            getOutFilter().add("date");
038            getOutFilter().add("pragma");
039            getOutFilter().add("trailer");
040            getOutFilter().add("transfer-encoding");
041            getOutFilter().add("upgrade");
042            getOutFilter().add("via");
043            getOutFilter().add("warning");
044            
045            setLowerCase(true);
046            
047            // filter headers begin with "Camel" or "org.apache.camel"
048            // must ignore case for Http based transports
049            setOutFilterPattern("(?i)(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
050        }
051    }