Class ModifyPayloadExceptionHandler

java.lang.Object
com.adaptris.core.json.schema.ValidationExceptionHandlerImpl
com.adaptris.core.json.schema.ModifyPayloadExceptionHandler
All Implemented Interfaces:
ValidationExceptionHandler

@ComponentProfile(summary="Store schema violations as part of the JSON payload", tag="json,validation") public class ModifyPayloadExceptionHandler extends ValidationExceptionHandlerImpl
Implementation of ValidationExceptionHandler that stores the violations as part of the payload.

This implementation modifies the existing payload so that it is rewritten to be something like

 
    { "original" : { // the original message },
      "schema-violations" : [ // list of validation failures ]
    }
   
 

In the adapter configuration file this class is aliased as json-schema-validation-exception-into-message which is the preferred alternative to the fully qualified classname when building your configuration.

  • Constructor Details

    • ModifyPayloadExceptionHandler

      public ModifyPayloadExceptionHandler()
    • ModifyPayloadExceptionHandler

      public ModifyPayloadExceptionHandler(Boolean throwException)
  • Method Details

    • handle

      public void handle(org.everit.json.schema.ValidationException exc, AdaptrisMessage msg) throws ServiceException
      Throws:
      ServiceException
    • getThrowException

      public Boolean getThrowException()
    • setThrowException

      public void setThrowException(Boolean b)
      After adding the ValidationException to the payload throw an exception.
      Parameters:
      b - true to throw an exception; false otherwise (default false).