Spring Web Services Framework

org.springframework.ws.server.endpoint
Class AbstractJDomPayloadEndpoint

java.lang.Object
  extended by org.springframework.xml.transform.TransformerObjectSupport
      extended by org.springframework.ws.server.endpoint.AbstractJDomPayloadEndpoint
All Implemented Interfaces:
PayloadEndpoint

public abstract class AbstractJDomPayloadEndpoint
extends TransformerObjectSupport
implements PayloadEndpoint

Abstract base class for endpoints that handle the message payload as JDOM elements.

Offers the message payload as a JDOM Element, and allows subclasses to create a response by returning an Element.

AbstractJDomPayloadEndpoint can accept only one payload element. Multiple payload elements are not in accordance with WS-I.

Since:
1.0.0
Author:
Arjen Poutsma

Field Summary
 
Fields inherited from class org.springframework.xml.transform.TransformerObjectSupport
logger
 
Constructor Summary
AbstractJDomPayloadEndpoint()
           
 
Method Summary
protected  Element getDocumentElement(Source source)
          Returns the payload element of the given source.
 Source invoke(Source request)
          Invokes the endpoint with the given request payload, and possibly returns a response.
protected abstract  Element invokeInternal(Element requestElement)
          Template method.
 void setAlwaysTransform(boolean alwaysTransform)
          Set if the request Source should always be transformed into a new JDOMResult.
 
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 Detail

AbstractJDomPayloadEndpoint

public AbstractJDomPayloadEndpoint()
Method Detail

setAlwaysTransform

public void setAlwaysTransform(boolean alwaysTransform)
Set if the request Source should always be transformed into a new JDOMResult.

Default is false, which is faster.


invoke

public final Source invoke(Source request)
                    throws Exception
Description copied from interface: PayloadEndpoint
Invokes the endpoint with the given request payload, and possibly returns a response.

Specified by:
invoke in interface PayloadEndpoint
Parameters:
request - the payload of the request message, may be null
Returns:
the payload of the response message, may be null to indicate no response
Throws:
Exception - if an exception occurs

getDocumentElement

protected Element getDocumentElement(Source source)
                              throws TransformerException
Returns the payload element of the given source.

Default implementation checks whether the source is a DOMSource, and uses a DOMBuilder to create a JDOM Element. In all other cases, or when alwaysTransform is true, the source is transformed into a JDOMResult, which is more expensive. If the passed source is null, null is returned.

Parameters:
source - the source to return the root element of; can be null
Returns:
the document element
Throws:
TransformerException - in case of errors

invokeInternal

protected abstract Element invokeInternal(Element requestElement)
                                   throws Exception
Template method. Subclasses must implement this. Offers the request payload as a JDOM Element, and allows subclasses to return a response Element.

Parameters:
requestElement - the contents of the SOAP message as JDOM element
Returns:
the response element. Can be null to specify no response.
Throws:
Exception

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.