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

public class MarshallingPayloadMethodProcessor extends AbstractPayloadMethodProcessor
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

    Constructors
    Constructor
    Description
    Creates a new MarshallingPayloadMethodProcessor.
    MarshallingPayloadMethodProcessor(org.springframework.oxm.Marshaller marshaller)
    Creates a new MarshallingPayloadMethodProcessor with the given marshaller.
    MarshallingPayloadMethodProcessor(org.springframework.oxm.Marshaller marshaller, org.springframework.oxm.Unmarshaller unmarshaller)
    Creates a new MarshallingPayloadMethodProcessor with the given marshaller and unmarshaller.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.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 with RequestPayload, is supported by this resolver.
    protected boolean
    supportsResponsePayloadReturnType(org.springframework.core.MethodParameter returnType)
    Indicates whether the given method return type, annotated with ResponsePayload, 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MarshallingPayloadMethodProcessor

      public MarshallingPayloadMethodProcessor()
      Creates a new MarshallingPayloadMethodProcessor. The Marshaller and Unmarshaller must be injected using properties.
      See Also:
    • MarshallingPayloadMethodProcessor

      public MarshallingPayloadMethodProcessor(org.springframework.oxm.Marshaller marshaller)
      Creates a new MarshallingPayloadMethodProcessor with the given marshaller. If the given Marshaller also implements the Unmarshaller interface, it is used for both marshalling and unmarshalling. Otherwise, an exception is thrown.

      Note that all Marshaller implementations in Spring also implement the Unmarshaller interface, so that you can safely use this constructor.

      Parameters:
      marshaller - object used as marshaller and unmarshaller
      Throws:
      IllegalArgumentException - when marshaller does not implement the Unmarshaller interface
    • MarshallingPayloadMethodProcessor

      public MarshallingPayloadMethodProcessor(org.springframework.oxm.Marshaller marshaller, org.springframework.oxm.Unmarshaller unmarshaller)
      Creates a new MarshallingPayloadMethodProcessor with the given marshaller and unmarshaller.
      Parameters:
      marshaller - the marshaller to use
      unmarshaller - 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 with RequestPayload, is supported by this resolver.
      Specified by:
      supportsRequestPayloadParameter in class AbstractPayloadMethodProcessor
      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 context
      parameter - the parameter to resolve to an argument. This parameter must have previously been passed to the MethodArgumentResolver.supportsParameter(MethodParameter) method of this interface, which must have returned true.
      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 with ResponsePayload, is supported.
      Specified by:
      supportsResponsePayloadReturnType in class AbstractPayloadMethodProcessor
      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 context
      returnType - the return type to handle. This type must have previously been passed to the MethodReturnValueHandler.supportsReturnType(MethodParameter) method of this interface, which must have returned true.
      returnValue - the return value to handle
      Throws:
      Exception - in case of errors