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.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,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", label="rest", lenientProperties=true, headersClass=org.apache.camel.component.cxf.common.message.CxfConstants.class) public class CxfRsEndpoint extends org.apache.camel.support.DefaultEndpoint implements org.apache.camel.spi.HeaderFilterStrategyAware, org.apache.camel.ServiceExpose JAX-RS REST services using Apache CXF or connect to external REST services using CXF REST client.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.cxf.Busbus
-
Constructor Summary
Constructors Constructor Description CxfRsEndpoint()CxfRsEndpoint(String endpointUri, org.apache.camel.Component component)CxfRsEndpoint(org.apache.camel.Component component, String uri, org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean bean)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddResourceClass(Class<?> resourceClass)protected voidcheckBeanType(Object object, Class<?> clazz)org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor)org.apache.cxf.jaxrs.client.JAXRSClientFactoryBeancreateJAXRSClientFactoryBean()org.apache.cxf.jaxrs.client.JAXRSClientFactoryBeancreateJAXRSClientFactoryBean(String address)org.apache.cxf.jaxrs.JAXRSServerFactoryBeancreateJAXRSServerFactoryBean()org.apache.camel.ProducercreateProducer()protected voiddoInit()protected voiddoStop()StringgetAddress()StringgetBeanId()CxfRsBindinggetBinding()BindingStylegetBindingStyle()org.apache.cxf.BusgetBus()CxfRsConfigurergetChainedCxfRsEndpointConfigurer()longgetContinuationTimeout()org.apache.camel.http.base.cookie.CookieHandlergetCookieHandler()CxfRsConfigurergetCxfRsConfigurer()List<org.apache.cxf.feature.Feature>getFeatures()org.apache.camel.spi.HeaderFilterStrategygetHeaderFilterStrategy()HostnameVerifiergetHostnameVerifier()List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>getInFaultInterceptors()List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>getInInterceptors()intgetLoggingSizeLimit()intgetMaxClientCacheSize()StringgetModelRef()protected CxfRsConfigurergetNullSafeCxfRsEndpointConfigurer()List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>getOutFaultInterceptors()List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>getOutInterceptors()Map<String,String>getParameters()Map<String,Object>getProperties()List<?>getProviders()StringgetPublishedEndpointUrl()List<Class<?>>getResourceClasses()List<String>getSchemaLocations()List<?>getServiceBeans()org.apache.camel.support.jsse.SSLContextParametersgetSslContextParameters()booleanisDefaultBus()booleanisHttpClientAPI()booleanisIgnoreDeleteMethodMessageBody()booleanisLenientProperties()booleanisLoggingFeatureEnabled()This option enables CXF Logging Feature which writes inbound and outbound REST messages to log.booleanisPerformInvocation()booleanisPropagateContexts()booleanisSkipFaultLogging()booleanisSynchronous()booleanisThrowExceptionOnFailure()protected org.apache.cxf.jaxrs.client.JAXRSClientFactoryBeannewJAXRSClientFactoryBean()protected org.apache.cxf.jaxrs.JAXRSServerFactoryBeannewJAXRSServerFactoryBean()protected StringresolvePropertyPlaceholders(String str)voidsetAddress(String address)The service publish address.voidsetBeanId(String beanId)voidsetBinding(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.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 ?_wadlvoidsetResourceClasses(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, doStart, 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, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
isLenientProperties
public boolean isLenientProperties()
- Specified by:
isLenientPropertiesin interfaceorg.apache.camel.Endpoint- Overrides:
isLenientPropertiesin classorg.apache.camel.support.DefaultEndpoint
-
updateEndpointUri
protected void updateEndpointUri(String endpointUri)
-
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
public org.apache.camel.Producer createProducer() throws Exception- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
setBinding
public void setBinding(CxfRsBinding binding)
To use a custom CxfBinding to control the binding between Camel Message and CXF Message.
-
getBinding
public CxfRsBinding getBinding()
-
isSkipFaultLogging
public boolean isSkipFaultLogging()
-
getChainedCxfRsEndpointConfigurer
public CxfRsConfigurer getChainedCxfRsEndpointConfigurer()
-
setSkipFaultLogging
public void setSkipFaultLogging(boolean skipFaultLogging)
This option controls whether the PhaseInterceptorChain skips logging the Fault that it catches.
-
setupJAXRSServerFactoryBean
protected void setupJAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean sfb)
-
getNullSafeCxfRsEndpointConfigurer
protected CxfRsConfigurer 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()
-
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)
-
addResourceClass
public void addResourceClass(Class<?> resourceClass)
-
setResourceClasses
public void setResourceClasses(List<Class<?>> resourceClasses)
The resource classes which you want to export as REST service. Multiple classes can be separated by comma.
-
setResourceClasses
public void setResourceClasses(Class<?>... classes)
-
getServiceBeans
public List<?> getServiceBeans()
-
setServiceBeans
public void setServiceBeans(String beans)
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
public void setServiceBeans(List<?> beans)
-
setServiceBean
public void setServiceBean(Object bean)
-
setAddress
public void setAddress(String address)
The service publish address.
-
getModelRef
public String getModelRef()
-
setModelRef
public void setModelRef(String ref)
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
public String getAddress()
-
getPublishedEndpointUrl
public String getPublishedEndpointUrl()
-
setPublishedEndpointUrl
public void setPublishedEndpointUrl(String publishedEndpointUrl)
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.
-
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
public BindingStyle getBindingStyle()
-
getProviders
public List<?> getProviders()
-
setProviders
public void setProviders(List<?> providers)
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
public void setProviders(String providers)
Set custom JAX-RS provider(s) list which is looked up in the registry. Multiple entries can be separated by comma.
-
setProvider
public void setProvider(Object provider)
Set custom JAX-RS provider to the CxfRs endpoint.
-
setSchemaLocation
public void setSchemaLocation(String schema)
Sets the locations of the schema(s) which can be used to validate the incoming XML or JAXB-driven JSON.
-
setSchemaLocations
public void setSchemaLocations(List<String> schemas)
Sets the locations of the schema(s) which can be used to validate the incoming XML or JAXB-driven JSON.
-
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
public List<org.apache.cxf.feature.Feature> getFeatures()
-
setFeatures
public void setFeatures(List<org.apache.cxf.feature.Feature> features)
Set the feature list to the CxfRs endpoint.
-
setBindingStyle
public void setBindingStyle(BindingStyle bindingStyle)
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
public String getBeanId()
-
setBeanId
public void setBeanId(String beanId)
-
doInit
protected void doInit() throws Exception- Overrides:
doInitin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.support.DefaultEndpoint- 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
public HostnameVerifier getHostnameVerifier()
-
setHostnameVerifier
public void setHostnameVerifier(HostnameVerifier hostnameVerifier)
The hostname verifier to be used. Use the # notation to reference a HostnameVerifier from the registry.
-
getCxfRsConfigurer
public CxfRsConfigurer getCxfRsConfigurer()
-
setCxfRsConfigurer
public void setCxfRsConfigurer(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. 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)
-
-