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 java.util.Map;
020    
021    import org.apache.camel.Endpoint;
022    import org.apache.camel.impl.DefaultComponent;
023    
024    /**
025     * Defines the <a href="http://activemq.apache.org/camel/http.html">HTTP
026     * Component</a>
027     * 
028     * @version $Revision: 563665 $
029     */
030    public class HttpComponent extends DefaultComponent<HttpExchange> {
031    
032        private CamelServlet camelServlet;
033    
034        /**
035         * Connects the URL specified on the endpoint to the specified processor.
036         * 
037         * @throws Exception
038         */
039        public void connect(HttpConsumer consumer) throws Exception {
040            camelServlet.connect(consumer);
041        }
042    
043        /**
044         * Disconnects the URL specified on the endpoint from the specified
045         * processor.
046         * 
047         * @throws Exception
048         */
049        public void disconnect(HttpConsumer consumer) throws Exception {
050            camelServlet.disconnect(consumer);
051        }
052    
053        public CamelServlet getCamelServlet() {
054            return camelServlet;
055        }
056    
057        public void setCamelServlet(CamelServlet camelServlet) {
058            this.camelServlet = camelServlet;
059        }
060    
061        @Override
062        protected Endpoint<HttpExchange> createEndpoint(String uri, String remaining, Map parameters) throws Exception {
063            return new HttpEndpoint(uri, this);
064        }
065    
066    }