public class StandardResponseHandler extends AbstractHttpHandler implements IResponseHandler
Modifier and Type | Field and Description |
---|---|
protected IMethodConfiguration |
method
Contains the method configuration to which this handler is attached to.
|
Constructor and Description |
---|
StandardResponseHandler() |
Modifier and Type | Method and Description |
---|---|
protected int |
applyAdditionalTransformation(int resNode)
Applies additional transformations as laid out by the XSL registered in
the method implementation and returns the modified NOM xml
|
boolean |
canProcess(java.lang.String contentType)
Checks if the response can be processed by the handler
|
protected int |
convertHttpResponseToXml(HttpMethod httpMethod,
Document doc)
Converts the HTTP response to XML.
|
int |
convertResponseToXml(HttpMethod httpMethod,
IServerConnection serverConnection,
Document doc)
Converts the response bytes to XML.
|
protected int |
defineParentNode(Document doc)
Utility method that gives the concrete classes an opportunity to override
and append the HTTP response on a determined parent node.
|
protected int |
executeXslt(int responseNode,
IMethodConfiguration method)
Executes the XSLT transformation configured for this handler.
|
java.util.List<java.lang.String> |
getSupportedContentTypes()
Returns supported content types
|
protected int |
handleResponseXPath(int responseNode,
IMethodConfiguration method)
Fetches the response element using the configured XPath.
|
void |
initialize(int configXml,
IXSLTStore xslStore,
IMethodConfiguration method,
XPathMetaInfo xmi)
Initializes this handler.
|
protected int |
postProcessXml(int reqNode)
Method which can do processing of the response XML after the XSLT
transform is executed.
|
protected int |
preProcessXml(int reqNode)
Method which can do processing of the response XML before the XSLT
transform is called.
|
getPerformanceCounters, setPerformanceCounters
protected IMethodConfiguration method
public int convertResponseToXml(HttpMethod httpMethod, IServerConnection serverConnection, Document doc) throws XMLException, ConnectorException, java.io.IOException
IResponseHandler
convertResponseToXml
in interface IResponseHandler
httpMethod
- HTTP method from which the response will be read.serverConnection
- Server connection information.doc
- NOM document.XMLException
- Thrown if the XML parsing failed.ConnectorException
java.io.IOException
IResponseHandler.convertResponseToXml(HttpMethod, IServerConnection,
Document)
protected int applyAdditionalTransformation(int resNode) throws ConnectorException
resNode
- http response in NOM xml formatConnectorException
public void initialize(int configXml, IXSLTStore xslStore, IMethodConfiguration method, XPathMetaInfo xmi) throws ConnectorException
IResponseHandler
initialize
in interface IResponseHandler
configXml
- Handler configuration XML from the method configuration.xslStore
- HTTP Connector instance.method
- MethodConfiguration to which this handler belongs to.xmi
- The XPathMetaInfo object containing the prefix ns mapped to
the proper namespace.ConnectorException
IResponseHandler.initialize(int, IXSLTStore, IMethodConfiguration,
XPathMetaInfo)
protected int convertHttpResponseToXml(HttpMethod httpMethod, Document doc) throws java.io.IOException, XMLException
httpMethod
- HTTP method object from which the response data is read.doc
- NOM document for creating the XML.java.io.IOException
XMLException
protected int defineParentNode(Document doc)
doc
- the NOM documentprotected int executeXslt(int responseNode, IMethodConfiguration method) throws ConnectorException
responseNode
- Response node to be transformed.method
- Current method configuration.ConnectorException
protected int handleResponseXPath(int responseNode, IMethodConfiguration method)
responseNode
- Response node to be transformed.method
- Current method configuration.protected int postProcessXml(int reqNode)
This implementation just returns the node as-is.
reqNode
- Request XML node.protected int preProcessXml(int reqNode) throws ConnectorException
This implementation just returns the node as-is.
reqNode
- Request XML node.ConnectorException
- Thrown if the operation failed.public boolean canProcess(java.lang.String contentType)
IResponseHandler
canProcess
in interface IResponseHandler
contentType
- response content typepublic java.util.List<java.lang.String> getSupportedContentTypes()
IResponseHandler
getSupportedContentTypes
in interface IResponseHandler