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 */ 017package org.apache.camel.spi; 018 019import java.util.Map; 020 021import org.apache.camel.CamelContext; 022import org.apache.camel.Exchange; 023import org.apache.camel.Producer; 024 025/** 026 * Allows SPI to plugin a {@link RestProducerFactory} that creates the Camel {@link Producer} responsible 027 * for performing HTTP requests to call a remote REST service. 028 */ 029public interface RestProducerFactory { 030 031 /** 032 * Creates a new REST producer. 033 * 034 * @param camelContext the camel context 035 * @param host host in the syntax scheme:hostname:port, such as http:myserver:8080 036 * @param verb HTTP verb such as GET, POST 037 * @param basePath base path 038 * @param uriTemplate uri template 039 * @param queryParameters uri query parameters 040 * @param consumes media-types for what the REST service consume as input (accept-type), is <tt>null</tt> or <tt>*/*</tt> for anything 041 * @param produces media-types for what the REST service produces as output, can be <tt>null</tt> 042 * @param parameters additional parameters 043 * @return a newly created REST producer 044 * @throws Exception can be thrown 045 */ 046 Producer createProducer(CamelContext camelContext, String host, 047 String verb, String basePath, String uriTemplate, String queryParameters, 048 String consumes, String produces, Map<String, Object> parameters) throws Exception; 049}