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