Spring Web Services Framework

org.springframework.ws.server.endpoint
Class AbstractSaxPayloadEndpoint

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

public abstract class AbstractSaxPayloadEndpoint
extends TransformerObjectSupport
implements PayloadEndpoint

Abstract base class for endpoints that handle the message payload with a SAX ContentHandler. Allows subclasses to create a response by returning a Source.

Implementations of this class should create a new handler for each call of createContentHandler, because of thread safety. The handlers is later passed on to createResponse, so it can be used for holding request-specific state.

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
createContentHandler(), getResponse(org.xml.sax.ContentHandler)

Field Summary
 
Fields inherited from class org.springframework.xml.transform.TransformerObjectSupport
logger
 
Constructor Summary
AbstractSaxPayloadEndpoint()
           
 
Method Summary
protected abstract  ContentHandler createContentHandler()
          Returns the SAX ContentHandler used to parse the incoming request payload.
protected abstract  Source getResponse(ContentHandler contentHandler)
          Returns the response to be given, if any.
 Source invoke(Source request)
          Invokes the provided ContentHandler on the given request.
 
Methods inherited from class org.springframework.xml.transform.TransformerObjectSupport
createTransformer, getTransformerFactory, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSaxPayloadEndpoint

public AbstractSaxPayloadEndpoint()
Method Detail

invoke

public final Source invoke(Source request)
                    throws Exception
Invokes the provided ContentHandler on the given request. After parsing has been done, the provided response is returned.

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
See Also:
createContentHandler(), getResponse(org.xml.sax.ContentHandler)

createContentHandler

protected abstract ContentHandler createContentHandler()
                                                throws Exception
Returns the SAX ContentHandler used to parse the incoming request payload. A new instance should be created for each call, because of thread-safety. The content handler can be used to hold request-specific state.

If an incoming message does not contain a payload, this method will not be invoked.

Returns:
a SAX content handler to be used for parsing
Throws:
Exception

getResponse

protected abstract Source getResponse(ContentHandler contentHandler)
                               throws Exception
Returns the response to be given, if any. This method is called after the request payload has been parsed using the SAX ContentHandler. The passed ContentHandler is created by createContentHandler(): it can be used to hold request-specific state.

If an incoming message does not contain a payload, this method will be invoked with null as content handler.

Parameters:
contentHandler - the content handler used to parse the request
Throws:
Exception

Spring Web Services Framework

Copyright � 2005-2008 The Spring Web Services Framework. All Rights Reserved.