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 Details

    • bus

      @UriParam(label="advanced") protected org.apache.cxf.Bus bus
  • Constructor Details

    • CxfRsEndpoint

      public CxfRsEndpoint()
    • CxfRsEndpoint

      public CxfRsEndpoint(String endpointUri, org.apache.camel.Component component)
    • CxfRsEndpoint

      public CxfRsEndpoint(org.apache.camel.Component component, String uri, org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean bean)
  • Method Details

    • isLenientProperties

      public boolean isLenientProperties()
      Specified by:
      isLenientProperties in interface org.apache.camel.Endpoint
      Overrides:
      isLenientProperties in class org.apache.camel.support.DefaultEndpoint
    • updateEndpointUri

      protected void updateEndpointUri(String endpointUri)
    • setParameters

      public void setParameters(Map<String,String> param)
    • getParameters

      public Map<String,String> 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:
      getHeaderFilterStrategy in interface org.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 interface org.apache.camel.spi.HeaderFilterStrategyAware
    • createConsumer

      public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
      Specified by:
      createConsumer in interface org.apache.camel.Endpoint
      Throws:
      Exception
    • createProducer

      public org.apache.camel.Producer createProducer() throws Exception
      Specified by:
      createProducer in interface org.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.
    • checkBeanType

      protected void checkBeanType(Object object, Class<?> clazz)
    • 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()
    • resolvePropertyPlaceholders

      protected String resolvePropertyPlaceholders(String str)
    • 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

      public List<Class<?>> getResourceClasses()
    • 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 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

      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.
    • getSchemaLocations

      public List<String> 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

      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.
    • getProperties

      public Map<String,Object> getProperties()
    • setProperties

      public void setProperties(Map<String,Object> properties)
    • 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.
    • getBeanId

      public String getBeanId()
    • setBeanId

      public void setBeanId(String beanId)
    • doInit

      protected void doInit() throws Exception
      Overrides:
      doInit in class org.apache.camel.support.DefaultEndpoint
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.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

      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)