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.jetty;
018    
019    import org.apache.camel.Exchange;
020    import org.apache.camel.spi.HeaderFilterStrategy;
021    
022    /**
023     * Jetty specific binding to parse the response when using {@link org.apache.camel.component.jetty.JettyHttpProducer}
024     *
025     * @version $Revision: 835332 $
026     */
027    public interface JettyHttpBinding {
028    
029        /**
030         * Parses the response from the Jetty client.
031         *
032         * @param exchange  the Exchange which to populate with the response
033         * @param httpExchange  the response from the Jetty client
034         * @throws Exception is thrown if error parsing response
035         */
036        void populateResponse(Exchange exchange, JettyContentExchange httpExchange) throws Exception;
037    
038        /**
039         * Gets the header filter strategy
040         *
041         * @return the strategy
042         */
043        HeaderFilterStrategy getHeaderFilterStrategy();
044    
045        /**
046         * Sets the header filter strategy to use.
047         * <p/>
048         * Will default use {@link org.apache.camel.component.http.HttpHeaderFilterStrategy}
049         *
050         * @param headerFilterStrategy the custom strategy
051         */
052        void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy);
053    
054        /**
055         * Whether to throw {@link org.apache.camel.component.http.HttpOperationFailedException}
056         * in case of response code != 200.
057         *
058         * @param throwExceptionOnFailure <tt>true</tt> to throw exception
059         */
060        void setThrowExceptionOnFailure(boolean throwExceptionOnFailure);
061    
062        /**
063         * Whether to throw {@link org.apache.camel.component.http.HttpOperationFailedException}
064         * in case of response code != 200.
065         *
066         * @return <tt>true</tt> to throw exception
067         */
068        boolean isThrowExceptionOnFailure();
069    
070    }