public class ExceptionAsXml extends java.lang.Object implements ExceptionSerializer
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.
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
Constructor and Description |
---|
ExceptionAsXml() |
public ExceptionAsXml withDocumentMerge(DocumentMerge docMerge)
public ExceptionAsXml withExceptionGenerator(ExceptionReportGenerator e)
public ExceptionAsXml withXmlEncoding(java.lang.String e)
public ExceptionAsXml withDocumentFactoryConfig(DocumentBuilderFactoryBuilder e)
public ExceptionAsXml withIgnoreXmlParseExceptions(java.lang.Boolean b)
public void serialize(java.lang.Exception exception, AdaptrisMessage msg) throws CoreException
ExceptionSerializer
serialize
in interface ExceptionSerializer
exception
- the exceptionmsg
- the messageCoreException
- wrapping other exceptions.public DocumentMerge getDocumentMerge()
public void setDocumentMerge(DocumentMerge m)
m
- the merge implementation, if not specified defaults to ReplaceOriginal
public ExceptionReportGenerator getExceptionGenerator()
public void setExceptionGenerator(ExceptionReportGenerator generator)
generator
- the generator, if not specified defaults to SimpleExceptionReport
.public java.lang.String getXmlEncoding()
public void setXmlEncoding(java.lang.String encoding)
encoding
- the encoding, default is UTF-8public DocumentBuilderFactoryBuilder getXmlDocumentFactoryConfig()
public void setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder xml)
public java.lang.Boolean getIgnoreXmlParseExceptions()
public void setIgnoreXmlParseExceptions(java.lang.Boolean b)
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.
b
- true to ignore parse exceptions (default is false if not specified.