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
- Direct Known Subclasses:
CxfRsSpringEndpoint
@UriEndpoint(firstVersion="2.0.0", scheme="cxfrs", title="CXF-RS", syntax="cxfrs:beanId:address", label="rest", lenientProperties=true) 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
Fields Modifier and Type Field Description protected org.apache.cxf.Bus
bus
-
Constructor Summary
Constructors Constructor Description CxfRsEndpoint()
CxfRsEndpoint(String endpointUri, org.apache.camel.Component component)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResourceClass(Class<?> resourceClass)
protected void
checkBeanType(Object object, Class<?> clazz)
org.apache.camel.Consumer
createConsumer(org.apache.camel.Processor processor)
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean
createJAXRSClientFactoryBean()
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean
createJAXRSClientFactoryBean(String address)
org.apache.cxf.jaxrs.JAXRSServerFactoryBean
createJAXRSServerFactoryBean()
org.apache.camel.Producer
createProducer()
protected void
doInit()
protected void
doStop()
String
getAddress()
String
getBeanId()
CxfRsBinding
getBinding()
BindingStyle
getBindingStyle()
org.apache.cxf.Bus
getBus()
CxfRsConfigurer
getChainedCxfRsEndpointConfigurer()
long
getContinuationTimeout()
org.apache.camel.http.base.cookie.CookieHandler
getCookieHandler()
CxfRsConfigurer
getCxfRsConfigurer()
List<org.apache.cxf.feature.Feature>
getFeatures()
org.apache.camel.spi.HeaderFilterStrategy
getHeaderFilterStrategy()
HostnameVerifier
getHostnameVerifier()
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()
int
getLoggingSizeLimit()
int
getMaxClientCacheSize()
String
getModelRef()
protected CxfRsConfigurer
getNullSafeCxfRsEndpointConfigurer()
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()
String
getPublishedEndpointUrl()
List<Class<?>>
getResourceClasses()
List<String>
getSchemaLocations()
List<?>
getServiceBeans()
org.apache.camel.support.jsse.SSLContextParameters
getSslContextParameters()
boolean
isDefaultBus()
boolean
isHttpClientAPI()
boolean
isIgnoreDeleteMethodMessageBody()
boolean
isLenientProperties()
boolean
isLoggingFeatureEnabled()
This option enables CXF Logging Feature which writes inbound and outbound REST messages to log.boolean
isPerformInvocation()
boolean
isPropagateContexts()
boolean
isSkipFaultLogging()
boolean
isSynchronous()
boolean
isThrowExceptionOnFailure()
protected org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean
newJAXRSClientFactoryBean()
protected org.apache.cxf.jaxrs.JAXRSServerFactoryBean
newJAXRSServerFactoryBean()
protected String
resolvePropertyPlaceholders(String str)
void
setAddress(String address)
The service publish address.void
setBeanId(String beanId)
void
setBinding(CxfRsBinding binding)
To use a custom CxfBinding to control the binding between Camel Message and CXF Message.void
setBindingStyle(BindingStyle bindingStyle)
Sets how requests and responses will be mapped to/from Camel.void
setBus(org.apache.cxf.Bus bus)
To use a custom configured CXF Bus.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.void
setCookieHandler(org.apache.camel.http.base.cookie.CookieHandler cookieHandler)
Configure a cookie handler to maintain a HTTP sessionvoid
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.void
setDefaultBus(boolean isSetDefaultBus)
Will set the default bus when CXF endpoint create a bus by itselfvoid
setFeatures(List<org.apache.cxf.feature.Feature> features)
Set the feature list to the CxfRs endpoint.void
setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy strategy)
To use a custom HeaderFilterStrategy to filter header to and from Camel message.void
setHostnameVerifier(HostnameVerifier hostnameVerifier)
The hostname verifier to be used.void
setHttpClientAPI(boolean clientAPI)
If it is true, the CxfRsProducer will use the HttpClientAPI to invoke the service.void
setIgnoreDeleteMethodMessageBody(boolean ignoreDeleteMethodMessageBody)
This option is used to tell CxfRsProducer to ignore the message body of the DELETE method when using HTTP API.void
setInFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors)
Set the inFaultInterceptors to the CxfRs endpoint.void
setInInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors)
Set the inInterceptors to the CxfRs endpoint.void
setLoggingFeatureEnabled(boolean loggingFeatureEnabled)
void
setLoggingSizeLimit(int loggingSizeLimit)
To limit the total size of number of bytes the logger will output when logging feature has been enabled.void
setMaxClientCacheSize(int maxClientCacheSize)
This option allows you to configure the maximum size of the cache.void
setModelRef(String ref)
This option is used to specify the model file which is useful for the resource class without annotation.void
setOutFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors)
Set the outFaultInterceptors to the CxfRs endpoint.void
setOutInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors)
Set the outInterceptor to the CxfRs endpoint.void
setParameters(Map<String,String> param)
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.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.void
setProperties(Map<String,Object> properties)
void
setProvider(Object provider)
Set custom JAX-RS provider to the CxfRs endpoint.void
setProviders(String providers)
Set custom JAX-RS provider(s) list which is looked up in the registry.void
setProviders(List<?> providers)
Set custom JAX-RS provider(s) list to the CxfRs endpoint.void
setPublishedEndpointUrl(String publishedEndpointUrl)
This option can override the endpointUrl that published from the WADL which can be accessed with resource address url plus ?_wadlvoid
setResourceClasses(Class<?>... classes)
void
setResourceClasses(List<Class<?>> resourceClasses)
The resource classes which you want to export as REST service.void
setSchemaLocation(String schema)
Sets the locations of the schema(s) which can be used to validate the incoming XML or JAXB-driven JSON.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.void
setServiceBean(Object bean)
void
setServiceBeans(String beans)
The service beans (the bean ids to lookup in the registry) which you want to export as REST service.void
setServiceBeans(List<?> beans)
void
setSkipFaultLogging(boolean skipFaultLogging)
This option controls whether the PhaseInterceptorChain skips logging the Fault that it catches.void
setSslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters)
The Camel SSL setting reference.void
setSynchronous(boolean synchronous)
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.protected void
setupCommonFactoryProperties(org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean factory)
protected void
setupJAXRSClientFactoryBean(org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean cfb, String address)
protected void
setupJAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean sfb)
protected void
updateEndpointUri(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
-
-
-
-
Constructor Detail
-
CxfRsEndpoint
public CxfRsEndpoint()
-
CxfRsEndpoint
public CxfRsEndpoint(String endpointUri, org.apache.camel.Component component)
-
-
Method Detail
-
isLenientProperties
public boolean isLenientProperties()
- Specified by:
isLenientProperties
in interfaceorg.apache.camel.Endpoint
- Overrides:
isLenientProperties
in 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:
getHeaderFilterStrategy
in 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:
setHeaderFilterStrategy
in interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
- Specified by:
createConsumer
in interfaceorg.apache.camel.Endpoint
- Throws:
Exception
-
createProducer
public org.apache.camel.Producer createProducer() throws Exception
- Specified by:
createProducer
in 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
MessageContentsList
coming 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:
doInit
in classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in 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)
-
-