Class RestBindingAdvice

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.processor.RestBindingAdvice
All Implemented Interfaces:
AutoCloseable, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.CamelInternalProcessorAdvice<Map<String,Object>>, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

public class RestBindingAdvice extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.spi.CamelInternalProcessorAdvice<Map<String,Object>>
Used for Rest DSL with binding to json/xml for incoming requests and outgoing responses.

The binding uses DataFormat for the actual work to transform from xml/json to Java Objects and reverse again.

The rest producer side is implemented in

invalid reference
org.apache.camel.component.rest.RestProducerBindingProcessor
See Also:
  • Field Summary

    Fields 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
    Constructor
    Description
    RestBindingAdvice(org.apache.camel.CamelContext camelContext, org.apache.camel.spi.DataFormat jsonDataFormat, org.apache.camel.spi.DataFormat xmlDataFormat, org.apache.camel.spi.DataFormat outJsonDataFormat, org.apache.camel.spi.DataFormat outXmlDataFormat, String consumes, String produces, String bindingMode, boolean skipBindingOnErrorCode, boolean clientRequestValidation, boolean clientResponseValidation, boolean enableCORS, boolean enableNoContentResponse, Map<String,String> corsHeaders, Map<String,String> queryDefaultValues, Map<String,String> queryAllowedValues, boolean requiredBody, Set<String> requiredQueryParameters, Set<String> requiredHeaders, Map<String,String> responseCodes, Set<String> responseHeaders, org.apache.camel.spi.RestClientRequestValidator clientRequestValidator, org.apache.camel.spi.RestClientResponseValidator clientResponseValidator)
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    after(org.apache.camel.Exchange exchange, Map<String,Object> state)
     
    before(org.apache.camel.Exchange exchange)
     
    org.apache.camel.spi.RestClientRequestValidator.ValidationError
    doClientRequestValidation(org.apache.camel.Exchange exchange)
    Performs the client request validation (if enabled)
    org.apache.camel.spi.RestClientResponseValidator.ValidationError
    doClientResponseValidation(org.apache.camel.Exchange exchange)
    Performs the client response validation (if enabled)
    protected void
     
    protected void
     

    Methods inherited from class org.apache.camel.support.service.BaseService

    build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getInternalLock, 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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.camel.spi.CamelInternalProcessorAdvice

    hasState

    Methods inherited from interface org.apache.camel.Service

    build, close, init, start, stop

    Methods inherited from interface org.apache.camel.ShutdownableService

    shutdown

    Methods inherited from interface org.apache.camel.StatefulService

    getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending

    Methods inherited from interface org.apache.camel.SuspendableService

    isSuspended, resume, suspend
  • Constructor Details

    • RestBindingAdvice

      public RestBindingAdvice(org.apache.camel.CamelContext camelContext, org.apache.camel.spi.DataFormat jsonDataFormat, org.apache.camel.spi.DataFormat xmlDataFormat, org.apache.camel.spi.DataFormat outJsonDataFormat, org.apache.camel.spi.DataFormat outXmlDataFormat, String consumes, String produces, String bindingMode, boolean skipBindingOnErrorCode, boolean clientRequestValidation, boolean clientResponseValidation, boolean enableCORS, boolean enableNoContentResponse, Map<String,String> corsHeaders, Map<String,String> queryDefaultValues, Map<String,String> queryAllowedValues, boolean requiredBody, Set<String> requiredQueryParameters, Set<String> requiredHeaders, Map<String,String> responseCodes, Set<String> responseHeaders, org.apache.camel.spi.RestClientRequestValidator clientRequestValidator, org.apache.camel.spi.RestClientResponseValidator clientResponseValidator) throws Exception
      Throws:
      Exception
  • Method Details

    • before

      public Map<String,Object> before(org.apache.camel.Exchange exchange) throws Exception
      Specified by:
      before in interface org.apache.camel.spi.CamelInternalProcessorAdvice<Map<String,Object>>
      Throws:
      Exception
    • after

      public void after(org.apache.camel.Exchange exchange, Map<String,Object> state) throws Exception
      Specified by:
      after in interface org.apache.camel.spi.CamelInternalProcessorAdvice<Map<String,Object>>
      Throws:
      Exception
    • doClientRequestValidation

      public org.apache.camel.spi.RestClientRequestValidator.ValidationError doClientRequestValidation(org.apache.camel.Exchange exchange)
      Performs the client request validation (if enabled)
      Parameters:
      exchange - the exchange
      Returns:
      null if success otherwise an error is returned
    • doClientResponseValidation

      public org.apache.camel.spi.RestClientResponseValidator.ValidationError doClientResponseValidation(org.apache.camel.Exchange exchange)
      Performs the client response validation (if enabled)
      Parameters:
      exchange - the exchange
      Returns:
      null if success otherwise an error is returned
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.apache.camel.support.service.BaseService
      Throws:
      Exception