Package org.apache.camel.component.rest
Class RestEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.rest.RestEndpoint
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.ComponentAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasCamelContext,org.apache.camel.spi.HasId,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="2.14.0",
scheme="rest",
title="REST",
syntax="rest:method:path:uriTemplate",
category={CORE,REST},
lenientProperties=true,
headersClass=RestConstants.class)
@Metadata(annotations="protocol=http")
public class RestEndpoint
extends org.apache.camel.support.DefaultEndpoint
Expose REST services or call external REST services.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final String[]static final String[]static final StringFields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureProperties(Map<String, Object> options) org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.camel.Producerorg.apache.camel.spi.RestConfiguration.RestBindingModegetHost()getPath()booleanvoidThe openapi api doc resource to use.voidsetBindingMode(String bindingMode) voidsetBindingMode(org.apache.camel.spi.RestConfiguration.RestBindingMode bindingMode) Configures the binding mode for the producer.voidsetConsumerComponentName(String consumerComponentName) The Camel Rest component to use for the consumer REST transport, such as jetty, servlet, undertow.voidsetConsumes(String consumes) Media type such as: 'text/xml', or 'application/json' this REST service accepts.voidsetDescription(String description) Human description to document this REST servicevoidHost and port of HTTP service to use (override host in openapi schema)voidTo declare the incoming POJO binding type as a FQN class namevoidHTTP method to use.voidsetOutType(String outType) To declare the outgoing POJO binding type as a FQN class namevoidsetParameters(Map<String, Object> parameters) Additional parameters to configure the consumer of the REST transport for this REST servicevoidThe base path, can use * as path suffix to support wildcard HTTP route matching.voidsetProducerComponentName(String producerComponentName) The Camel Rest component to use for the producer REST transport, such as http, undertow.voidsetProduces(String produces) Media type such as: 'text/xml', or 'application/json' this REST service returns.voidsetQueryParameters(String queryParameters) Query parameters for the HTTP service to call.voidsetRouteId(String routeId) Name of the route this REST services createsvoidsetUriTemplate(String uriTemplate) The uri templateMethods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.ComponentAware
getComponentMethods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isRemote, isSingletonProducerMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
DEFAULT_REST_CONSUMER_COMPONENTS
-
DEFAULT_REST_PRODUCER_COMPONENTS
-
DEFAULT_API_COMPONENT_NAME
- See Also:
-
RESOURCE_PATH
- See Also:
-
-
Constructor Details
-
RestEndpoint
-
-
Method Details
-
configureProperties
- Specified by:
configurePropertiesin interfaceorg.apache.camel.Endpoint- Overrides:
configurePropertiesin classorg.apache.camel.support.DefaultEndpoint
-
getComponent
- Specified by:
getComponentin interfaceorg.apache.camel.ComponentAware- Overrides:
getComponentin classorg.apache.camel.support.DefaultEndpoint
-
getMethod
-
setMethod
HTTP method to use. -
getPath
-
setPath
The base path, can use * as path suffix to support wildcard HTTP route matching. -
getUriTemplate
-
setUriTemplate
The uri template -
getConsumes
-
setConsumes
Media type such as: 'text/xml', or 'application/json' this REST service accepts. By default we accept all kinds of types. -
getProduces
-
setProduces
Media type such as: 'text/xml', or 'application/json' this REST service returns. -
getProducerComponentName
-
setProducerComponentName
The Camel Rest component to use for the producer REST transport, such as http, undertow. If no component has been explicitly configured, then Camel will lookup if there is a Camel component that integrates with the Rest DSL, or if a org.apache.camel.spi.RestProducerFactory is registered in the registry. If either one is found, then that is being used. -
getConsumerComponentName
-
setConsumerComponentName
The Camel Rest component to use for the consumer REST transport, such as jetty, servlet, undertow. If no component has been explicitly configured, then Camel will lookup if there is a Camel component that integrates with the Rest DSL, or if a org.apache.camel.spi.RestConsumerFactory is registered in the registry. If either one is found, then that is being used. -
getInType
-
setInType
To declare the incoming POJO binding type as a FQN class name -
getOutType
-
setOutType
To declare the outgoing POJO binding type as a FQN class name -
getRouteId
-
setRouteId
Name of the route this REST services creates -
getDescription
-
setDescription
Human description to document this REST service -
getParameters
-
setParameters
Additional parameters to configure the consumer of the REST transport for this REST service -
getApiDoc
-
setApiDoc
The openapi api doc resource to use. The resource is loaded from classpath by default and must be in JSON format. -
getHost
-
setHost
Host and port of HTTP service to use (override host in openapi schema) -
getQueryParameters
-
setQueryParameters
Query parameters for the HTTP service to call. The query parameters can contain multiple parameters separated by ampersand such such as foo=123invalid input: '&bar'=456. -
getBindingMode
public org.apache.camel.spi.RestConfiguration.RestBindingMode getBindingMode() -
setBindingMode
public void setBindingMode(org.apache.camel.spi.RestConfiguration.RestBindingMode bindingMode) Configures the binding mode for the producer. If set to anything other than 'off' the producer will try to convert the body of the incoming message from inType to the json or xml, and the response from json or xml to outType. -
setBindingMode
-
createProducer
- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Throws:
Exception
-
isLenientProperties
public boolean isLenientProperties()- Specified by:
isLenientPropertiesin interfaceorg.apache.camel.Endpoint- Overrides:
isLenientPropertiesin classorg.apache.camel.support.DefaultEndpoint
-