public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloadMethodProcessor
MethodArgumentResolver
and MethodReturnValueHandler
implementations that use JAXB2. Creates JAXBContext
object lazily, and offers
marshalling and
unmarshalling
methods.logger
Constructor and Description |
---|
AbstractJaxb2PayloadMethodProcessor() |
Modifier and Type | Method and Description |
---|---|
protected Marshaller |
createMarshaller(JAXBContext jaxbContext)
Creates a new
Marshaller to be used for marshalling objects to XML. |
protected Unmarshaller |
createUnmarshaller(JAXBContext jaxbContext)
Creates a new
Unmarshaller to be used for unmarshalling XML to objects. |
protected void |
marshalToResponsePayload(MessageContext messageContext,
Class<?> clazz,
Object jaxbElement)
Marshals the given
jaxbElement to the response payload of the given message context. |
protected <T> JAXBElement<T> |
unmarshalElementFromRequestPayload(MessageContext messageContext,
Class<T> clazz)
Unmarshals the request payload of the given message context as
JAXBElement . |
protected Object |
unmarshalFromRequestPayload(MessageContext messageContext,
Class<?> clazz)
Unmarshals the request payload of the given message context.
|
convertToByteArrayInputStream, supportsParameter, supportsRequestPayloadParameter, supportsResponsePayloadReturnType, supportsReturnType
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
resolveArgument
handleReturnValue
protected final void marshalToResponsePayload(MessageContext messageContext, Class<?> clazz, Object jaxbElement) throws JAXBException
jaxbElement
to the response payload of the given message context.messageContext
- the message context to marshal toclazz
- the clazz to create a marshaller forjaxbElement
- the object to be marshalledJAXBException
- in case of JAXB2 errorsprotected final Object unmarshalFromRequestPayload(MessageContext messageContext, Class<?> clazz) throws JAXBException
messageContext
- the message context to unmarshal fromclazz
- the class to unmarshalnull
if the request has no payloadJAXBException
- in case of JAXB2 errorsprotected final <T> JAXBElement<T> unmarshalElementFromRequestPayload(MessageContext messageContext, Class<T> clazz) throws JAXBException
JAXBElement
.messageContext
- the message context to unmarshal fromclazz
- the class to unmarshalnull
if the request has no payloadJAXBException
- in case of JAXB2 errorsprotected Marshaller createMarshaller(JAXBContext jaxbContext) throws JAXBException
Marshaller
to be used for marshalling objects to XML. Defaults to
JAXBContext.createMarshaller()
, but can be overridden in subclasses for further
customization.jaxbContext
- the JAXB context to create a marshaller forJAXBException
- in case of JAXB errorsprotected Unmarshaller createUnmarshaller(JAXBContext jaxbContext) throws JAXBException
Unmarshaller
to be used for unmarshalling XML to objects. Defaults to
JAXBContext.createUnmarshaller()
, but can be overridden in subclasses for further
customization.jaxbContext
- the JAXB context to create a unmarshaller forJAXBException
- in case of JAXB errorsCopyright © 2005–2015 The Spring Web Services Framework. All rights reserved.