cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject cxf git commit: [CXF-6217] Use faster method for parsing the strings from blueprint. (use StringReader instead of ByteArrayInputStream and use StaxUtils)
Date Wed, 01 Jul 2015 14:13:23 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 1623553cf -> e1d0a78fa


[CXF-6217] Use faster method for parsing the strings from blueprint.  (use StringReader instead
of ByteArrayInputStream and use StaxUtils)


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e1d0a78f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e1d0a78f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e1d0a78f

Branch: refs/heads/master
Commit: e1d0a78fa8ce50aa5c88a9d12bed01509936af94
Parents: 1623553
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Jul 1 10:12:06 2015 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Jul 1 10:12:06 2015 -0400

----------------------------------------------------------------------
 .../blueprint/JettyHTTPServerEngineFactoryHolder.java  | 13 ++++---------
 .../blueprint/NettyHttpServerEngineFactoryHolder.java  | 13 +++++--------
 2 files changed, 9 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e1d0a78f/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/blueprint/JettyHTTPServerEngineFactoryHolder.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/blueprint/JettyHTTPServerEngineFactoryHolder.java
b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/blueprint/JettyHTTPServerEngineFactoryHolder.java
index ace5b41..348de38 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/blueprint/JettyHTTPServerEngineFactoryHolder.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/blueprint/JettyHTTPServerEngineFactoryHolder.java
@@ -18,7 +18,7 @@
  */
 package org.apache.cxf.transport.http_jetty.blueprint;
 
-import java.io.ByteArrayInputStream;
+import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -31,7 +31,6 @@ import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
-import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.w3c.dom.Element;
 
@@ -41,6 +40,7 @@ import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.jsse.TLSServerParameters;
 import org.apache.cxf.configuration.jsse.TLSServerParametersConfig;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
 import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory;
 import org.apache.cxf.transport.http_jetty.ThreadingParameters;
@@ -71,13 +71,8 @@ public class JettyHTTPServerEngineFactoryHolder {
 
     public void init() {
         try {
-
-            DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
-            docFactory.setNamespaceAware(true);
-
-            Element element = docFactory.newDocumentBuilder()
-                .parse(new ByteArrayInputStream(parsedElement.getBytes())).getDocumentElement();
-
+            Element element = StaxUtils.read(new StringReader(parsedElement)).getDocumentElement();
+            
             JettyHTTPServerEngineFactoryConfigType config 
                 = (JettyHTTPServerEngineFactoryConfigType) getJaxbObject(element,
                     JettyHTTPServerEngineFactoryConfigType.class);

http://git-wip-us.apache.org/repos/asf/cxf/blob/e1d0a78f/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/blueprint/NettyHttpServerEngineFactoryHolder.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/blueprint/NettyHttpServerEngineFactoryHolder.java
b/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/blueprint/NettyHttpServerEngineFactoryHolder.java
index 00786db..7700949 100644
--- a/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/blueprint/NettyHttpServerEngineFactoryHolder.java
+++ b/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/blueprint/NettyHttpServerEngineFactoryHolder.java
@@ -18,7 +18,7 @@
  */
 package org.apache.cxf.transport.http.netty.server.blueprint;
 
-import java.io.ByteArrayInputStream;
+import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -26,11 +26,12 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.logging.Logger;
+
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
-import javax.xml.parsers.DocumentBuilderFactory;
+
 import org.w3c.dom.Element;
 
 import org.apache.cxf.common.jaxb.JAXBContextCache;
@@ -39,6 +40,7 @@ import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.jsse.TLSServerParameters;
 import org.apache.cxf.configuration.jsse.TLSServerParametersConfig;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.transport.http.netty.server.NettyHttpServerEngine;
 import org.apache.cxf.transport.http.netty.server.NettyHttpServerEngineFactory;
 import org.apache.cxf.transport.http.netty.server.ThreadingParameters;
@@ -63,12 +65,7 @@ public class NettyHttpServerEngineFactoryHolder {
 
     public void init() {
         try {
-
-            DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
-            docFactory.setNamespaceAware(true);
-
-            Element element = docFactory.newDocumentBuilder()
-                .parse(new ByteArrayInputStream(parsedElement.getBytes())).getDocumentElement();
+            Element element = StaxUtils.read(new StringReader(parsedElement)).getDocumentElement();
 
             NettyHttpServerEngineFactoryConfigType config 
                 = (NettyHttpServerEngineFactoryConfigType) getJaxbObject(element,


Mime
View raw message