org.springframework.ws.server.endpoint.adapter.method.jaxb
Class AbstractJaxb2PayloadMethodProcessor
java.lang.Object
org.springframework.xml.transform.TransformerObjectSupport
org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadMethodProcessor
org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor
All Implemented Interfaces: MethodArgumentResolver , MethodReturnValueHandler
Direct Known Subclasses: JaxbElementPayloadMethodProcessor , XmlRootElementPayloadMethodProcessor
public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloadMethodProcessor
Abstract base class for MethodArgumentResolver
and MethodReturnValueHandler
implementations that use JAXB2. Creates JAXBContext
object lazily, and offers
marshalling and
unmarshalling
methods.
Since:
2.0
Author:
Arjen Poutsma
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
AbstractJaxb2PayloadMethodProcessor
public AbstractJaxb2PayloadMethodProcessor ()
marshalToResponsePayload
protected final void marshalToResponsePayload (MessageContext messageContext,
Class <?> clazz,
Object jaxbElement)
throws JAXBException
Marshals the given jaxbElement
to the response payload of the given message context.
Parameters: messageContext
- the message context to marshal toclazz
- the clazz to create a marshaller forjaxbElement
- the object to be marshalled
Throws:
JAXBException
- in case of JAXB2 errors
unmarshalFromRequestPayload
protected final Object unmarshalFromRequestPayload (MessageContext messageContext,
Class <?> clazz)
throws JAXBException
Unmarshals the request payload of the given message context.
Parameters: messageContext
- the message context to unmarshal fromclazz
- the class to unmarshal
Returns: the unmarshalled object, or null
if the request has no payload
Throws:
JAXBException
- in case of JAXB2 errors
unmarshalElementFromRequestPayload
protected final <T> JAXBElement <T> unmarshalElementFromRequestPayload (MessageContext messageContext,
Class <T> clazz)
throws JAXBException
Unmarshals the request payload of the given message context as JAXBElement
.
Parameters: messageContext
- the message context to unmarshal fromclazz
- the class to unmarshal
Returns: the unmarshalled element, or null
if the request has no payload
Throws:
JAXBException
- in case of JAXB2 errors
createMarshaller
protected Marshaller createMarshaller (JAXBContext jaxbContext)
throws JAXBException
Creates a new Marshaller
to be used for marshalling objects to XML. Defaults to
JAXBContext.createMarshaller()
, but can be overridden in subclasses for further
customization.
Parameters: jaxbContext
- the JAXB context to create a marshaller for
Returns: the marshaller
Throws:
JAXBException
- in case of JAXB errors
createUnmarshaller
protected Unmarshaller createUnmarshaller (JAXBContext jaxbContext)
throws JAXBException
Creates a new Unmarshaller
to be used for unmarshalling XML to objects. Defaults to
JAXBContext.createUnmarshaller()
, but can be overridden in subclasses for further
customization.
Parameters: jaxbContext
- the JAXB context to create a unmarshaller for
Returns: the unmarshaller
Throws:
JAXBException
- in case of JAXB errors
Copyright © 2005-2013 The Spring Web Services Framework . All Rights Reserved.