com.bankframe.ei.channel.codec
Class XMLXSLCodec
java.lang.Object
com.bankframe.ei.channel.codec.XMLDOMCodec
com.bankframe.ei.channel.codec.DPTPDOMCodec
com.bankframe.ei.channel.codec.XMLXSLCodec
- All Implemented Interfaces:
- Codec
- Direct Known Subclasses:
- B2BXMLCodec, FooXmlXslCodec
- public abstract class XMLXSLCodec
- extends DPTPDOMCodec
This class decodes and encodes XML data, applying an
XSL transformation to map arbitrary XML to Eontec XML. In order
to know what XSL stylesheet to use this class must know the content-type
of the XML, this is specified by passing the content-type to the constructor
Since instances of Codec are always created through the use of reflection
this class must be declared abstract. To support a specific type of XML document
a sub-class of this class must created with a default constructor that
specifies the correct type of that XML document. The request and response
content types can be different, use the appropriate constructor if the
request and response content-types are different.
Response and Request content types are the same
e.g.:
public class AcmeXMLCodec extends XMLXSLCodec {
public static final String CONTENT_TYPE="application/x-acme-xml";
public AcmeXMLCodec() {
super(CONTENT_TYPE);
}
public String getName() {
return "AcmeXMLCodec";
}
}
Response and Request content types are the different
e.g.:
public class AcmeXMLCodec extends XMLXSLCodec {
public static final String REQUEST_CONTENT_TYPE="application/x-acme-request-xml";
public static final String RESPONSE_CONTENT_TYPE="application/x-acme-response-xml";
public AcmeXMLCodec() {
super(REQUEST_CONTENT_TYPE,RESPONSE_CONTENT_TYPE);
}
public String getName() {
return "AcmeXMLCodec";
}
}
The XSL style-sheet to use for the transformation is determined by mapping the
content-type to a setting in BankframeResource.properties
. For the
first example above the following keys would need to be present in BankframeResource.properties
channel.http.xml.xsl.request.content-type.application/x-acme-request-xml=http://localhost/somepath/foo-request.xsl
channel.http.xml.xsl.response.content-type.application/x-acme-request-xml=http://localhost/somepath/foo-response.xsl
Method Summary |
java.util.Vector |
decode(org.w3c.dom.Document xml)
|
org.w3c.dom.Document |
encodeXml(java.util.Vector dps)
|
boolean |
isTracing()
|
void |
setTracing(boolean tracing)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XSL_REQUEST_MAPPING
public static final java.lang.String XSL_REQUEST_MAPPING
- See Also:
- Constant Field Values
XSL_RESPONSE_MAPPING
public static final java.lang.String XSL_RESPONSE_MAPPING
- See Also:
- Constant Field Values
XSL_TRACE_TRANSFORM
public static final java.lang.String XSL_TRACE_TRANSFORM
- See Also:
- Constant Field Values
decode
public java.util.Vector decode(org.w3c.dom.Document xml)
- Overrides:
decode
in class DPTPDOMCodec
- See Also:
XmlDomCodec#decode(Document)
encodeXml
public org.w3c.dom.Document encodeXml(java.util.Vector dps)
- Overrides:
encodeXml
in class DPTPDOMCodec
- See Also:
XmlDomCodec#encodeXml(Vector)
setTracing
public void setTracing(boolean tracing)
isTracing
public boolean isTracing()
Copyright © 2005, 2007, Oracle. All rights reserved.