Class MarshallingPayloadMethodProcessor
java.lang.Object
org.springframework.xml.transform.TransformerObjectSupport
org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadMethodProcessor
org.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessor
- All Implemented Interfaces:
MethodArgumentResolver
,MethodReturnValueHandler
Implementation of
MethodArgumentResolver
and MethodReturnValueHandler
that uses Marshaller
and Unmarshaller
to support marshalled objects.- Since:
- 2.0
- Author:
- Arjen Poutsma
-
Field Summary
Fields inherited from class org.springframework.xml.transform.TransformerObjectSupport
logger
-
Constructor Summary
ConstructorDescriptionCreates a newMarshallingPayloadMethodProcessor
.MarshallingPayloadMethodProcessor
(org.springframework.oxm.Marshaller marshaller) Creates a newMarshallingPayloadMethodProcessor
with the given marshaller.MarshallingPayloadMethodProcessor
(org.springframework.oxm.Marshaller marshaller, org.springframework.oxm.Unmarshaller unmarshaller) Creates a newMarshallingPayloadMethodProcessor
with the given marshaller and unmarshaller. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.oxm.Marshaller
Returns the marshaller used for transforming objects into XML.org.springframework.oxm.Unmarshaller
Returns the unmarshaller used for transforming XML into objects.void
handleReturnValue
(MessageContext messageContext, org.springframework.core.MethodParameter returnType, Object returnValue) Handles the given return value.resolveArgument
(MessageContext messageContext, org.springframework.core.MethodParameter parameter) Resolves the given parameter into a method argument.void
setMarshaller
(org.springframework.oxm.Marshaller marshaller) Sets the marshaller used for transforming objects into XML.void
setUnmarshaller
(org.springframework.oxm.Unmarshaller unmarshaller) Sets the unmarshaller used for transforming XML into objects.protected boolean
supportsRequestPayloadParameter
(org.springframework.core.MethodParameter parameter) Indicates whether the given method parameter, annotated withRequestPayload
, is supported by this resolver.protected boolean
supportsResponsePayloadReturnType
(org.springframework.core.MethodParameter returnType) Indicates whether the given method return type, annotated withResponsePayload
, is supported.Methods inherited from class org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadMethodProcessor
convertToByteArrayInputStream, supportsParameter, supportsReturnType
Methods inherited from class org.springframework.xml.transform.TransformerObjectSupport
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform
-
Constructor Details
-
MarshallingPayloadMethodProcessor
public MarshallingPayloadMethodProcessor()Creates a newMarshallingPayloadMethodProcessor
. TheMarshaller
andUnmarshaller
must be injected using properties. -
MarshallingPayloadMethodProcessor
public MarshallingPayloadMethodProcessor(org.springframework.oxm.Marshaller marshaller) Creates a newMarshallingPayloadMethodProcessor
with the given marshaller. If the givenMarshaller
also implements theUnmarshaller
interface, it is used for both marshalling and unmarshalling. Otherwise, an exception is thrown.Note that all
Marshaller
implementations in Spring also implement theUnmarshaller
interface, so that you can safely use this constructor.- Parameters:
marshaller
- object used as marshaller and unmarshaller- Throws:
IllegalArgumentException
- whenmarshaller
does not implement theUnmarshaller
interface
-
MarshallingPayloadMethodProcessor
public MarshallingPayloadMethodProcessor(org.springframework.oxm.Marshaller marshaller, org.springframework.oxm.Unmarshaller unmarshaller) Creates a newMarshallingPayloadMethodProcessor
with the given marshaller and unmarshaller.- Parameters:
marshaller
- the marshaller to useunmarshaller
- the unmarshaller to use
-
-
Method Details
-
getMarshaller
public org.springframework.oxm.Marshaller getMarshaller()Returns the marshaller used for transforming objects into XML. -
setMarshaller
public void setMarshaller(org.springframework.oxm.Marshaller marshaller) Sets the marshaller used for transforming objects into XML. -
getUnmarshaller
public org.springframework.oxm.Unmarshaller getUnmarshaller()Returns the unmarshaller used for transforming XML into objects. -
setUnmarshaller
public void setUnmarshaller(org.springframework.oxm.Unmarshaller unmarshaller) Sets the unmarshaller used for transforming XML into objects. -
supportsRequestPayloadParameter
protected boolean supportsRequestPayloadParameter(org.springframework.core.MethodParameter parameter) Description copied from class:AbstractPayloadMethodProcessor
Indicates whether the given method parameter, annotated withRequestPayload
, is supported by this resolver.- Specified by:
supportsRequestPayloadParameter
in classAbstractPayloadMethodProcessor
- Parameters:
parameter
- the method parameter to check- Returns:
true
if this resolver supports the supplied parameter;false
otherwise
-
resolveArgument
public Object resolveArgument(MessageContext messageContext, org.springframework.core.MethodParameter parameter) throws Exception Description copied from interface:MethodArgumentResolver
Resolves the given parameter into a method argument.- Parameters:
messageContext
- the current message contextparameter
- the parameter to resolve to an argument. This parameter must have previously been passed to theMethodArgumentResolver.supportsParameter(MethodParameter)
method of this interface, which must have returnedtrue
.- Returns:
- the resolved argument. May be
null
. - Throws:
Exception
- in case of errors
-
supportsResponsePayloadReturnType
protected boolean supportsResponsePayloadReturnType(org.springframework.core.MethodParameter returnType) Description copied from class:AbstractPayloadMethodProcessor
Indicates whether the given method return type, annotated withResponsePayload
, is supported.- Specified by:
supportsResponsePayloadReturnType
in classAbstractPayloadMethodProcessor
- Parameters:
returnType
- the method parameter to check- Returns:
true
if this resolver supports the supplied return type;false
otherwise
-
handleReturnValue
public void handleReturnValue(MessageContext messageContext, org.springframework.core.MethodParameter returnType, Object returnValue) throws Exception Description copied from interface:MethodReturnValueHandler
Handles the given return value.- Parameters:
messageContext
- the current message contextreturnType
- the return type to handle. This type must have previously been passed to theMethodReturnValueHandler.supportsReturnType(MethodParameter)
method of this interface, which must have returnedtrue
.returnValue
- the return value to handle- Throws:
Exception
- in case of errors
-