cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r834644 - in /cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor: FIStaxOutInterceptor.java WrappedOutInterceptor.java
Date Tue, 10 Nov 2009 20:09:46 GMT
Author: dkulp
Date: Tue Nov 10 20:09:46 2009
New Revision: 834644

URL: http://svn.apache.org/viewvc?rev=834644&view=rev
Log:
[CXF-2530] Try some pre-interned strings first to avoid StringBuilder
creation and concats and such.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FIStaxOutInterceptor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FIStaxOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FIStaxOutInterceptor.java?rev=834644&r1=834643&r2=834644&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FIStaxOutInterceptor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FIStaxOutInterceptor.java Tue
Nov 10 20:09:46 2009
@@ -53,10 +53,6 @@
         this();
         force = f;
     }
-    protected boolean isRequestor(Message message) {
-        return Boolean.TRUE.equals(message.containsKey(Message.REQUESTOR_ROLE));
-    }
-    
     
     public void handleMessage(Message message) {
         XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java?rev=834644&r1=834643&r2=834644&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
Tue Nov 10 20:09:46 2009
@@ -36,6 +36,11 @@
 
 public class WrappedOutInterceptor extends AbstractOutDatabindingInterceptor {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(WrappedOutInterceptor.class);
+    private static final String DEF_PREFIXES[] = new String[] {
+        "ns1".intern(), "ns2".intern(), "ns3".intern(),
+        "ns4".intern(), "ns5".intern(), "ns6".intern(),
+        "ns7".intern(), "ns8".intern(), "ns9".intern()
+    };
 
     private WrappedOutEndingInterceptor ending = new WrappedOutEndingInterceptor();
     
@@ -70,12 +75,21 @@
                     pfx = service.getDataBinding().getDeclaredNamespaceMappings().get(name.getNamespaceURI());
                 }
                 if (pfx == null) {
-                    int x = 1;
-                    while (!StringUtils.isEmpty(xmlWriter.getNamespaceContext()
-                                                     .getNamespaceURI("ns" + x))) {
-                        x++;
+                    for (String t : DEF_PREFIXES) {
+                        if (!StringUtils.isEmpty(xmlWriter.getNamespaceContext()
+                                                     .getNamespaceURI(t))) {
+                            pfx = t;
+                            break;
+                        }
+                    }
+                    if (pfx == null) {    
+                        int x = 10;
+                        while (!StringUtils.isEmpty(xmlWriter.getNamespaceContext()
+                                                         .getNamespaceURI("ns" + x))) {
+                            x++;
+                        }
+                        pfx = "ns" + x;
                     }
-                    pfx = "ns" + x;
                 }
                 xmlWriter.setPrefix(pfx, name.getNamespaceURI());
                 xmlWriter.writeStartElement(pfx, name.getLocalPart(), name.getNamespaceURI());



Mime
View raw message