Class CxfRsEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint
- 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.spi.HeaderFilterStrategyAware,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="2.0.0",
scheme="cxfrs",
title="CXF-RS",
syntax="cxfrs:beanId:address",
category=REST,
lenientProperties=true,
headersClass=org.apache.camel.component.cxf.common.message.CxfConstants.class)
@Metadata(annotations="protocol=http")
public class CxfRsEndpoint
extends org.apache.camel.support.DefaultEndpoint
implements org.apache.camel.spi.HeaderFilterStrategyAware, org.apache.camel.Service
Expose JAX-RS REST services using Apache CXF or connect to external REST services using CXF REST client.
-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionCxfRsEndpoint(String endpointUri, org.apache.camel.Component component) CxfRsEndpoint(org.apache.camel.Component component, String uri, org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean bean) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResourceClass(Class<?> resourceClass) protected voidcheckBeanType(Object object, Class<?> clazz) org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.cxf.jaxrs.client.JAXRSClientFactoryBeanorg.apache.cxf.jaxrs.client.JAXRSClientFactoryBeancreateJAXRSClientFactoryBean(String address) org.apache.cxf.jaxrs.JAXRSServerFactoryBeanorg.apache.camel.Producerprotected voiddoInit()protected voiddoStop()org.apache.cxf.BusgetBus()longorg.apache.camel.http.base.cookie.CookieHandlerList<org.apache.cxf.feature.Feature> org.apache.camel.spi.HeaderFilterStrategyList<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> intintprotected CxfRsConfigurerList<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> List<?> List<?> org.apache.camel.support.jsse.SSLContextParametersbooleanbooleanbooleanbooleanbooleanThis option enables CXF Logging Feature which writes inbound and outbound REST messages to log.booleanbooleanbooleanbooleanbooleanprotected org.apache.cxf.jaxrs.client.JAXRSClientFactoryBeanprotected org.apache.cxf.jaxrs.JAXRSServerFactoryBeanprotected StringvoidsetAddress(String address) The service publish address.voidvoidsetBinding(CxfRsBinding binding) To use a custom CxfBinding to control the binding between Camel Message and CXF Message.voidsetBindingStyle(BindingStyle bindingStyle) Sets how requests and responses will be mapped to/from Camel.voidsetBus(org.apache.cxf.Bus bus) To use a custom configured CXF Bus.voidsetContinuationTimeout(long continuationTimeout) This option is used to set the CXF continuation timeout which could be used in CxfConsumer by default when the CXF server is using Jetty or Servlet transport.voidsetCookieHandler(org.apache.camel.http.base.cookie.CookieHandler cookieHandler) Configure a cookie handler to maintain a HTTP sessionvoidsetCxfRsConfigurer(CxfRsConfigurer configurer) This option could apply the implementation of org.apache.camel.component.cxf.jaxrs.CxfRsEndpointConfigurer which supports to configure the CXF endpoint in programmatic way.voidsetDefaultBus(boolean isSetDefaultBus) Will set the default bus when CXF endpoint create a bus by itselfvoidsetFeatures(List<org.apache.cxf.feature.Feature> features) Set the feature list to the CxfRs endpoint.voidsetHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy strategy) To use a custom HeaderFilterStrategy to filter header to and from Camel message.voidsetHostnameVerifier(HostnameVerifier hostnameVerifier) The hostname verifier to be used.voidsetHttpClientAPI(boolean clientAPI) If it is true, the CxfRsProducer will use the HttpClientAPI to invoke the service.voidsetIgnoreDeleteMethodMessageBody(boolean ignoreDeleteMethodMessageBody) This option is used to tell CxfRsProducer to ignore the message body of the DELETE method when using HTTP API.voidsetInFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) Set the inFaultInterceptors to the CxfRs endpoint.voidsetInInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) Set the inInterceptors to the CxfRs endpoint.voidsetLoggingFeatureEnabled(boolean loggingFeatureEnabled) voidsetLoggingSizeLimit(int loggingSizeLimit) To limit the total size of number of bytes the logger will output when logging feature has been enabled and -1 for no limit.voidsetMaxClientCacheSize(int maxClientCacheSize) This option allows you to configure the maximum size of the cache.voidsetModelRef(String ref) This option is used to specify the model file which is useful for the resource class without annotation.voidsetOutFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) Set the outFaultInterceptors to the CxfRs endpoint.voidsetOutInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) Set the outInterceptor to the CxfRs endpoint.voidsetParameters(Map<String, String> param) voidsetPerformInvocation(boolean performInvocation) When the option is true, Camel will perform the invocation of the resource class instance and put the response object into the exchange for further processing.voidsetPropagateContexts(boolean propagateContexts) When the option is true, JAXRS UriInfo, HttpHeaders, Request and SecurityContext contexts will be available to custom CXFRS processors as typed Camel exchange properties.voidsetProperties(Map<String, Object> properties) voidsetProvider(Object provider) Set custom JAX-RS provider to the CxfRs endpoint.voidsetProviders(String providers) Set custom JAX-RS provider(s) list which is looked up in the registry.voidsetProviders(List<?> providers) Set custom JAX-RS provider(s) list to the CxfRs endpoint.voidsetPublishedEndpointUrl(String publishedEndpointUrl) This option can override the endpointUrl that published from the WADL which can be accessed with resource address url plus ?voidsetResourceClasses(Class<?>... classes) voidsetResourceClasses(List<Class<?>> resourceClasses) The resource classes which you want to export as REST service.voidsetSchemaLocation(String schema) Sets the locations of the schema(s) which can be used to validate the incoming XML or JAXB-driven JSON.voidsetSchemaLocations(List<String> schemas) Sets the locations of the schema(s) which can be used to validate the incoming XML or JAXB-driven JSON.voidsetServiceBean(Object bean) voidsetServiceBeans(String beans) The service beans (the bean ids to lookup in the registry) which you want to export as REST service.voidsetServiceBeans(List<?> beans) voidsetSkipFaultLogging(boolean skipFaultLogging) This option controls whether the PhaseInterceptorChain skips logging the Fault that it catches.voidsetSslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters) The Camel SSL setting reference.voidsetSynchronous(boolean synchronous) voidsetThrowExceptionOnFailure(boolean throwExceptionOnFailure) This option tells the CxfRsProducer to inspect return codes and will generate an Exception if the return code is larger than 207.protected voidsetupCommonFactoryProperties(org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean factory) protected voidsetupJAXRSClientFactoryBean(org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean cfb, String address) protected voidsetupJAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean sfb) protected voidupdateEndpointUri(String endpointUri) Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, equals, getCamelContext, getComponent, 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, 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
-
bus
@UriParam(label="advanced") protected org.apache.cxf.Bus bus
-
-
Constructor Details
-
CxfRsEndpoint
public CxfRsEndpoint() -
CxfRsEndpoint
-
CxfRsEndpoint
public CxfRsEndpoint(org.apache.camel.Component component, String uri, org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean bean)
-
-
Method Details
-
isLenientProperties
public boolean isLenientProperties()- Specified by:
isLenientPropertiesin interfaceorg.apache.camel.Endpoint- Overrides:
isLenientPropertiesin classorg.apache.camel.support.DefaultEndpoint
-
updateEndpointUri
-
setParameters
-
getParameters
-
setHttpClientAPI
public void setHttpClientAPI(boolean clientAPI) If it is true, the CxfRsProducer will use the HttpClientAPI to invoke the service. If it is false, the CxfRsProducer will use the ProxyClientAPI to invoke the service -
isHttpClientAPI
public boolean isHttpClientAPI() -
getHeaderFilterStrategy
public org.apache.camel.spi.HeaderFilterStrategy getHeaderFilterStrategy()- Specified by:
getHeaderFilterStrategyin interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
setHeaderFilterStrategy
public void setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy strategy) To use a custom HeaderFilterStrategy to filter header to and from Camel message.- Specified by:
setHeaderFilterStrategyin interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Specified by:
createConsumerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createProducer
- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
setBinding
To use a custom CxfBinding to control the binding between Camel Message and CXF Message. -
getBinding
-
isSkipFaultLogging
public boolean isSkipFaultLogging() -
getChainedCxfRsEndpointConfigurer
-
setSkipFaultLogging
public void setSkipFaultLogging(boolean skipFaultLogging) This option controls whether the PhaseInterceptorChain skips logging the Fault that it catches. -
checkBeanType
-
setupJAXRSServerFactoryBean
protected void setupJAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean sfb) -
getNullSafeCxfRsEndpointConfigurer
-
setupJAXRSClientFactoryBean
protected void setupJAXRSClientFactoryBean(org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean cfb, String address) -
setupCommonFactoryProperties
protected void setupCommonFactoryProperties(org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean factory) -
newJAXRSServerFactoryBean
protected org.apache.cxf.jaxrs.JAXRSServerFactoryBean newJAXRSServerFactoryBean() -
newJAXRSClientFactoryBean
protected org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean newJAXRSClientFactoryBean() -
resolvePropertyPlaceholders
-
createJAXRSServerFactoryBean
public org.apache.cxf.jaxrs.JAXRSServerFactoryBean createJAXRSServerFactoryBean() -
createJAXRSClientFactoryBean
public org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean createJAXRSClientFactoryBean() -
createJAXRSClientFactoryBean
public org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean createJAXRSClientFactoryBean(String address) -
getResourceClasses
-
addResourceClass
-
setResourceClasses
The resource classes which you want to export as REST service. Multiple classes can be separated by comma. -
setResourceClasses
-
getServiceBeans
-
setServiceBeans
The service beans (the bean ids to lookup in the registry) which you want to export as REST service. Multiple beans can be separated by comma -
setServiceBeans
-
setServiceBean
-
setAddress
The service publish address. -
getModelRef
-
setModelRef
This option is used to specify the model file which is useful for the resource class without annotation. When using this option, then the service class can be omitted, to emulate document-only endpoints -
getAddress
-
getPublishedEndpointUrl
-
setPublishedEndpointUrl
This option can override the endpointUrl that published from the WADL which can be accessed with resource address url plus ?_wadl -
isLoggingFeatureEnabled
public boolean isLoggingFeatureEnabled()This option enables CXF Logging Feature which writes inbound and outbound REST messages to log. -
setLoggingFeatureEnabled
public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) -
getLoggingSizeLimit
public int getLoggingSizeLimit() -
setLoggingSizeLimit
public void setLoggingSizeLimit(int loggingSizeLimit) To limit the total size of number of bytes the logger will output when logging feature has been enabled and -1 for no limit. -
isThrowExceptionOnFailure
public boolean isThrowExceptionOnFailure() -
setThrowExceptionOnFailure
public void setThrowExceptionOnFailure(boolean throwExceptionOnFailure) This option tells the CxfRsProducer to inspect return codes and will generate an Exception if the return code is larger than 207. -
setMaxClientCacheSize
public void setMaxClientCacheSize(int maxClientCacheSize) This option allows you to configure the maximum size of the cache. The implementation caches CXF clients or ClientFactoryBean in CxfProvider and CxfRsProvider. -
getMaxClientCacheSize
public int getMaxClientCacheSize() -
setBus
public void setBus(org.apache.cxf.Bus bus) To use a custom configured CXF Bus. -
getBus
public org.apache.cxf.Bus getBus() -
setDefaultBus
public void setDefaultBus(boolean isSetDefaultBus) Will set the default bus when CXF endpoint create a bus by itself -
isDefaultBus
public boolean isDefaultBus() -
isIgnoreDeleteMethodMessageBody
public boolean isIgnoreDeleteMethodMessageBody() -
setIgnoreDeleteMethodMessageBody
public void setIgnoreDeleteMethodMessageBody(boolean ignoreDeleteMethodMessageBody) This option is used to tell CxfRsProducer to ignore the message body of the DELETE method when using HTTP API. -
getBindingStyle
-
getProviders
-
setProviders
Set custom JAX-RS provider(s) list to the CxfRs endpoint. You can specify a string with a list of providers to lookup in the registy separated by comma. -
setProviders
Set custom JAX-RS provider(s) list which is looked up in the registry. Multiple entries can be separated by comma. -
setProvider
Set custom JAX-RS provider to the CxfRs endpoint. -
setSchemaLocation
Sets the locations of the schema(s) which can be used to validate the incoming XML or JAXB-driven JSON. -
setSchemaLocations
Sets the locations of the schema(s) which can be used to validate the incoming XML or JAXB-driven JSON. -
getSchemaLocations
-
getOutFaultInterceptors
public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getOutFaultInterceptors() -
getInFaultInterceptors
public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getInFaultInterceptors() -
getInInterceptors
public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getInInterceptors() -
getOutInterceptors
public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getOutInterceptors() -
setInInterceptors
public void setInInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) Set the inInterceptors to the CxfRs endpoint. -
setInFaultInterceptors
public void setInFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) Set the inFaultInterceptors to the CxfRs endpoint. -
setOutInterceptors
public void setOutInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) Set the outInterceptor to the CxfRs endpoint. -
setOutFaultInterceptors
public void setOutFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) Set the outFaultInterceptors to the CxfRs endpoint. -
getFeatures
-
setFeatures
Set the feature list to the CxfRs endpoint. -
getProperties
-
setProperties
-
setBindingStyle
Sets how requests and responses will be mapped to/from Camel. Two values are possible:- SimpleConsumer: This binding style processes request parameters, multiparts, etc. and maps them to IN
headers, IN attachments and to the message body. It aims to eliminate low-level processing of
MessageContentsList. It also also adds more flexibility and simplicity to the response mapping. Only available for consumers. - Default: The default style. For consumers this passes on a MessageContentsList to the route, requiring
low-level processing in the route. This is the traditional binding style, which simply dumps the
MessageContentsListcoming in from the CXF stack onto the IN message body. The user is then responsible for processing it according to the contract defined by the JAX-RS method signature. - Custom: allows you to specify a custom binding through the binding option.
- SimpleConsumer: This binding style processes request parameters, multiparts, etc. and maps them to IN
headers, IN attachments and to the message body. It aims to eliminate low-level processing of
-
getBeanId
-
setBeanId
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
getContinuationTimeout
public long getContinuationTimeout() -
setContinuationTimeout
public void setContinuationTimeout(long continuationTimeout) This option is used to set the CXF continuation timeout which could be used in CxfConsumer by default when the CXF server is using Jetty or Servlet transport. -
isPerformInvocation
public boolean isPerformInvocation() -
setPerformInvocation
public void setPerformInvocation(boolean performInvocation) When the option is true, Camel will perform the invocation of the resource class instance and put the response object into the exchange for further processing. -
isPropagateContexts
public boolean isPropagateContexts() -
setPropagateContexts
public void setPropagateContexts(boolean propagateContexts) When the option is true, JAXRS UriInfo, HttpHeaders, Request and SecurityContext contexts will be available to custom CXFRS processors as typed Camel exchange properties. These contexts can be used to analyze the current requests using JAX-RS API. -
getSslContextParameters
public org.apache.camel.support.jsse.SSLContextParameters getSslContextParameters() -
setSslContextParameters
public void setSslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters) The Camel SSL setting reference. Use the # notation to reference the SSL Context. -
getHostnameVerifier
-
setHostnameVerifier
The hostname verifier to be used. Use the # notation to reference a HostnameVerifier from the registry. -
getCxfRsConfigurer
-
setCxfRsConfigurer
This option could apply the implementation of org.apache.camel.component.cxf.jaxrs.CxfRsEndpointConfigurer which supports to configure the CXF endpoint in programmatic way. User can configure the CXF server and client by implementing configure{Server/Client} method of CxfEndpointConfigurer. -
getCookieHandler
public org.apache.camel.http.base.cookie.CookieHandler getCookieHandler() -
setCookieHandler
public void setCookieHandler(org.apache.camel.http.base.cookie.CookieHandler cookieHandler) Configure a cookie handler to maintain a HTTP session -
isSynchronous
public boolean isSynchronous() -
setSynchronous
public void setSynchronous(boolean synchronous)
-