You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/10/09 06:27:19 UTC
[3/8] git commit: CAMEL-6842 XmlRpcDataFormat should support to
access XmlRpcStreamRequestConfig and TypeFactory
CAMEL-6842 XmlRpcDataFormat should support to access XmlRpcStreamRequestConfig and TypeFactory
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/12f00ef8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/12f00ef8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/12f00ef8
Branch: refs/heads/master
Commit: 12f00ef8e16c6fcc64e7edbe13ca61d87d1bf89f
Parents: 1f09761
Author: Willem Jiang <ni...@apache.org>
Authored: Wed Oct 9 11:47:37 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
Committed: Wed Oct 9 11:47:37 2013 +0800
----------------------------------------------------------------------
.../dataformat/xmlrpc/XmlRpcDataFormat.java | 29 +++++++++++++++-----
1 file changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/12f00ef8/components/camel-xmlrpc/src/main/java/org/apache/camel/dataformat/xmlrpc/XmlRpcDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-xmlrpc/src/main/java/org/apache/camel/dataformat/xmlrpc/XmlRpcDataFormat.java b/components/camel-xmlrpc/src/main/java/org/apache/camel/dataformat/xmlrpc/XmlRpcDataFormat.java
index 471ea38..b94db64 100644
--- a/components/camel-xmlrpc/src/main/java/org/apache/camel/dataformat/xmlrpc/XmlRpcDataFormat.java
+++ b/components/camel-xmlrpc/src/main/java/org/apache/camel/dataformat/xmlrpc/XmlRpcDataFormat.java
@@ -46,11 +46,10 @@ import org.apache.xmlrpc.parser.XmlRpcResponseParser;
import org.apache.xmlrpc.util.SAXParsers;
public class XmlRpcDataFormat implements DataFormat {
- private XmlRpcStreamRequestConfig config = new XmlRpcHttpRequestConfigImpl();
+ private XmlRpcStreamRequestConfig xmlRpcStreamRequestConfig = new XmlRpcHttpRequestConfigImpl();
private TypeFactory typeFactory = new TypeFactoryImpl(null);
private boolean isRequest;
-
protected XMLWriter getXMLWriter(Exchange exchange, OutputStream outputStream) throws XmlRpcException {
XMLWriter writer = new CharSetXMLWriter();
String encoding = IOHelper.getCharsetName(exchange);
@@ -69,13 +68,13 @@ public class XmlRpcDataFormat implements DataFormat {
public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
// need to check the object type
XMLWriter control = getXMLWriter(exchange, stream);
- XmlRpcWriter writer = new XmlRpcWriter(config, control, typeFactory);
+ XmlRpcWriter writer = new XmlRpcWriter(xmlRpcStreamRequestConfig, control, typeFactory);
if (graph instanceof XmlRpcRequest) {
- writer.writeRequest(config, (XmlRpcRequest)graph);
+ writer.writeRequest(xmlRpcStreamRequestConfig, (XmlRpcRequest)graph);
} else {
// write the result here directly
// TODO write the fault message here
- writer.write(config, graph);
+ writer.write(xmlRpcStreamRequestConfig, graph);
}
}
@@ -98,7 +97,7 @@ public class XmlRpcDataFormat implements DataFormat {
XMLReader xr = newXMLReader();
XmlRpcResponseParser xp;
try {
- xp = new XmlRpcResponseParser(config, typeFactory);
+ xp = new XmlRpcResponseParser(xmlRpcStreamRequestConfig, typeFactory);
xr.setContentHandler(xp);
xr.parse(isource);
} catch (SAXException e) {
@@ -128,7 +127,7 @@ public class XmlRpcDataFormat implements DataFormat {
XMLReader xr = newXMLReader();
XmlRpcRequestParser xp;
try {
- xp = new XmlRpcRequestParser(config, typeFactory);
+ xp = new XmlRpcRequestParser(xmlRpcStreamRequestConfig, typeFactory);
xr.setContentHandler(xp);
xr.parse(isource);
} catch (SAXException e) {
@@ -151,5 +150,21 @@ public class XmlRpcDataFormat implements DataFormat {
public void setRequest(boolean isRequest) {
this.isRequest = isRequest;
}
+
+ public void setXmlRpcStreamRequestConfig(XmlRpcStreamRequestConfig config) {
+ this.xmlRpcStreamRequestConfig = config;
+ }
+
+ public XmlRpcStreamRequestConfig getXmlRpcStreamRequestConfig() {
+ return xmlRpcStreamRequestConfig;
+ }
+
+ public void setTypeFactory(TypeFactory typeFactory) {
+ this.typeFactory = typeFactory;
+ }
+
+ public TypeFactory getTypeFactory() {
+ return typeFactory;
+ }
}