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
ConstructorsConstructorDescriptionCreates a newMarshallingPayloadMethodProcessor.MarshallingPayloadMethodProcessor(org.springframework.oxm.Marshaller marshaller) Creates a newMarshallingPayloadMethodProcessorwith the given marshaller.MarshallingPayloadMethodProcessor(org.springframework.oxm.Marshaller marshaller, org.springframework.oxm.Unmarshaller unmarshaller) Creates a newMarshallingPayloadMethodProcessorwith the given marshaller and unmarshaller. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.oxm.MarshallerReturns the marshaller used for transforming objects into XML.org.springframework.oxm.UnmarshallerReturns the unmarshaller used for transforming XML into objects.voidhandleReturnValue(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.voidsetMarshaller(org.springframework.oxm.Marshaller marshaller) Sets the marshaller used for transforming objects into XML.voidsetUnmarshaller(org.springframework.oxm.Unmarshaller unmarshaller) Sets the unmarshaller used for transforming XML into objects.protected booleansupportsRequestPayloadParameter(org.springframework.core.MethodParameter parameter) Indicates whether the given method parameter, annotated withRequestPayload, is supported by this resolver.protected booleansupportsResponsePayloadReturnType(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, supportsReturnTypeMethods inherited from class org.springframework.xml.transform.TransformerObjectSupport
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform
-
Constructor Details
-
MarshallingPayloadMethodProcessor
public MarshallingPayloadMethodProcessor()Creates a newMarshallingPayloadMethodProcessor. TheMarshallerandUnmarshallermust be injected using properties. -
MarshallingPayloadMethodProcessor
public MarshallingPayloadMethodProcessor(org.springframework.oxm.Marshaller marshaller) Creates a newMarshallingPayloadMethodProcessorwith the given marshaller. If the givenMarshalleralso implements theUnmarshallerinterface, it is used for both marshalling and unmarshalling. Otherwise, an exception is thrown.Note that all
Marshallerimplementations in Spring also implement theUnmarshallerinterface, so that you can safely use this constructor.- Parameters:
marshaller- object used as marshaller and unmarshaller- Throws:
IllegalArgumentException- whenmarshallerdoes not implement theUnmarshallerinterface
-
MarshallingPayloadMethodProcessor
public MarshallingPayloadMethodProcessor(org.springframework.oxm.Marshaller marshaller, org.springframework.oxm.Unmarshaller unmarshaller) Creates a newMarshallingPayloadMethodProcessorwith 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:AbstractPayloadMethodProcessorIndicates whether the given method parameter, annotated withRequestPayload, is supported by this resolver.- Specified by:
supportsRequestPayloadParameterin classAbstractPayloadMethodProcessor- Parameters:
parameter- the method parameter to check- Returns:
trueif this resolver supports the supplied parameter;falseotherwise
-
resolveArgument
public Object resolveArgument(MessageContext messageContext, org.springframework.core.MethodParameter parameter) throws Exception Description copied from interface:MethodArgumentResolverResolves 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:AbstractPayloadMethodProcessorIndicates whether the given method return type, annotated withResponsePayload, is supported.- Specified by:
supportsResponsePayloadReturnTypein classAbstractPayloadMethodProcessor- Parameters:
returnType- the method parameter to check- Returns:
trueif this resolver supports the supplied return type;falseotherwise
-
handleReturnValue
public void handleReturnValue(MessageContext messageContext, org.springframework.core.MethodParameter returnType, Object returnValue) throws Exception Description copied from interface:MethodReturnValueHandlerHandles 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
-