Class ExceptionAsXml

java.lang.Object
com.adaptris.core.services.exception.ExceptionAsXml
All Implemented Interfaces:
ExceptionSerializer

public class ExceptionAsXml extends Object implements ExceptionSerializer
Use with ExceptionReportService to write the exception as part of an xml document.

In the adapter configuration file this class is aliased as exception-as-xml which is the preferred alternative to the fully qualified classname when building your configuration.

  • Field Details

    • log

      protected transient org.slf4j.Logger log
  • Constructor Details

    • ExceptionAsXml

      public ExceptionAsXml()
  • Method Details

    • withDocumentMerge

      public ExceptionAsXml withDocumentMerge(DocumentMerge docMerge)
    • withExceptionGenerator

      public ExceptionAsXml withExceptionGenerator(ExceptionReportGenerator e)
    • withXmlEncoding

      public ExceptionAsXml withXmlEncoding(String e)
    • withDocumentFactoryConfig

      public ExceptionAsXml withDocumentFactoryConfig(DocumentBuilderFactoryBuilder e)
    • withIgnoreXmlParseExceptions

      public ExceptionAsXml withIgnoreXmlParseExceptions(Boolean b)
    • serialize

      public void serialize(Exception exception, AdaptrisMessage msg) throws CoreException
      Description copied from interface: ExceptionSerializer
      Serialize the exception into the adaptris message.
      Specified by:
      serialize in interface ExceptionSerializer
      Parameters:
      exception - the exception
      msg - the message
      Throws:
      CoreException - wrapping other exceptions.
    • getDocumentMerge

      public DocumentMerge getDocumentMerge()
    • setDocumentMerge

      public void setDocumentMerge(DocumentMerge m)
      Specify how to merge the exception into the AdaptrisMessage.
      Parameters:
      m - the merge implementation, if not specified defaults to ReplaceOriginal
    • getExceptionGenerator

      public ExceptionReportGenerator getExceptionGenerator()
    • setExceptionGenerator

      public void setExceptionGenerator(ExceptionReportGenerator generator)
      Specify how to create the XML document from the exception.
      Parameters:
      generator - the generator, if not specified defaults to SimpleExceptionReport.
    • getXmlEncoding

      public String getXmlEncoding()
    • setXmlEncoding

      public void setXmlEncoding(String encoding)
      Set the encoding for the resulting XML document.
      Parameters:
      encoding - the encoding, default is UTF-8
    • getXmlDocumentFactoryConfig

      public DocumentBuilderFactoryBuilder getXmlDocumentFactoryConfig()
    • setXmlDocumentFactoryConfig

      public void setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder xml)
    • getIgnoreXmlParseExceptions

      public Boolean getIgnoreXmlParseExceptions()
    • setIgnoreXmlParseExceptions

      public void setIgnoreXmlParseExceptions(Boolean b)
      Whether or not to ignore exceptions parsing the AdaptrisMessage.

      In some situations you might have an empty payload (such as when the workflow is fired by an HTTP GET request); but you want to report the exception as XML using ReplaceOriginal as the DocumentMerge implementation. If that is the case, then you should set this value to be true. It defaults to false to preserve backwards compatibility.

      Parameters:
      b - true to ignore parse exceptions (default is false if not specified.