cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r767155 - in /cxf/branches/2.1.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
Date Tue, 21 Apr 2009 14:18:46 GMT
Author: dkulp
Date: Tue Apr 21 14:18:46 2009
New Revision: 767155

URL: http://svn.apache.org/viewvc?rev=767155&view=rev
Log:
Merged revisions 766963 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r766963 | dkulp | 2009-04-20 23:20:21 -0400 (Mon, 20 Apr 2009) | 2 lines
  
  Cache the message factories
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
    cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Apr 21 14:18:46 2009
@@ -1 +1 @@
-/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962
+/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?rev=767155&r1=767154&r2=767155&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
Tue Apr 21 14:18:46 2009
@@ -65,7 +65,11 @@
  */
 public class SAAJInInterceptor extends AbstractSoapInterceptor {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(SAAJInInterceptor.class);
-
+    
+    private MessageFactory factory11;
+    private MessageFactory factory12;
+    
+    
     public SAAJInInterceptor() {
         super(Phase.PRE_PROTOCOL);
     }
@@ -73,15 +77,22 @@
         super(phase);
     }
     
+    private synchronized MessageFactory getFactory(SoapMessage message) throws SOAPException
{
+        if (message.getVersion() instanceof Soap11) {
+            if (factory11 == null) { 
+                factory11 = MessageFactory.newInstance();
+            } 
+            return factory11;
+        }
+        if (factory12 == null) {
+            factory12 = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+        }
+        return factory12;
+    }
+    
     public void handleMessage(SoapMessage message) throws Fault {
         try {
-            MessageFactory factory = null;
-            if (message.getVersion() instanceof Soap11) {
-                factory = MessageFactory.newInstance();
-            } else {
-                factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
-            }
-            
+            MessageFactory factory = getFactory(message);
             SOAPMessage soapMessage = factory.createMessage();
             message.setContent(SOAPMessage.class, soapMessage);
             

Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java?rev=767155&r1=767154&r2=767155&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
Tue Apr 21 14:18:46 2009
@@ -37,6 +37,7 @@
 
 
 import org.apache.cxf.attachment.AttachmentImpl;
+import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
@@ -65,22 +66,30 @@
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(SAAJOutInterceptor.class);
     private static final String ORIGINAL_XML_WRITER 
         = SAAJOutInterceptor.class.getName() + ".original.xml.writer";
-
+    private MessageFactory factory11;
+    private MessageFactory factory12;
+    
     public SAAJOutInterceptor() {
         super(Phase.PRE_PROTOCOL);
     }
-    
+    private synchronized MessageFactory getFactory(SoapMessage message) throws SOAPException
{
+        if (message.getVersion() instanceof Soap11) {
+            if (factory11 == null) { 
+                factory11 = MessageFactory.newInstance();
+            } 
+            return factory11;
+        }
+        if (factory12 == null) {
+            factory12 = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+        }
+        return factory12;
+    }
     public void handleMessage(SoapMessage message) throws Fault {
         SOAPMessage saaj = message.getContent(SOAPMessage.class);
         if (saaj == null) {
             SoapVersion version = message.getVersion();
             try {
-                MessageFactory factory = null;
-                if (version.getVersion() == 1.1) {
-                    factory = MessageFactory.newInstance();
-                } else {
-                    factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
-                }
+                MessageFactory factory = getFactory(message);
                 SOAPMessage soapMessage = factory.createMessage();
 
                 SOAPPart soapPart = soapMessage.getSOAPPart();



Mime
View raw message