cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject svn commit: r1456922 - in /cxf/trunk: api/src/main/java/org/apache/cxf/helpers/ api/src/main/java/org/apache/cxf/service/model/ api/src/main/java/org/apache/cxf/staxutils/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ rt/ws/security/src/main/jav...
Date Fri, 15 Mar 2013 12:18:15 GMT
Author: asoldano
Date: Fri Mar 15 12:18:14 2013
New Revision: 1456922

URL: http://svn.apache.org/r1456922
Log:
Misc minor performance fixes

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
    cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
    cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/AbstractDOMStreamReader.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java?rev=1456922&r1=1456921&r2=1456922&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java Fri Mar 15 12:18:14
2013
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Pattern;
 
 public final class HttpHeaderHelper {
     public static final String ACCEPT_ENCODING = "Accept-Encoding";
@@ -44,6 +45,7 @@ public final class HttpHeaderHelper {
     
     private static Map<String, String> internalHeaders = new HashMap<String, String>();
     private static ConcurrentHashMap<String, String> encodings = new ConcurrentHashMap<String,
String>();
+    private static Pattern charsetPattern = Pattern.compile("\"|'");
     
     static {
         internalHeaders.put("Accept-Encoding", "accept-encoding");
@@ -110,8 +112,7 @@ public final class HttpHeaderHelper {
         }
         // Charsets can be quoted. But it's quite certain that they can't have escaped quoted
or
         // anything like that.
-        enc = enc.replace("\"", "").trim();
-        enc = enc.replace("'", "");
+        enc = charsetPattern.matcher(enc).replaceAll("").trim();
         if ("".equals(enc)) {
             return deflt;
         }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java?rev=1456922&r1=1456921&r2=1456922&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java Fri Mar
15 12:18:14 2013
@@ -79,10 +79,8 @@ public final class ServiceModelUtil {
             return null;
         }
         BindingInfo service = ep.getEndpointInfo().getBinding();
-        Map<QName, BindingOperationInfo> wrapperMap =
-            CastUtils.cast(service.getProperty("ServiceModel.WRAPPER.MAP"
-                                               + (output ? "" : "_OUT"), Map.class));
-
+        Map<QName, BindingOperationInfo> wrapperMap = CastUtils.cast(service.getProperty(output
+            ? "ServiceModel.WRAPPER.MAP_OUT" : "ServiceModel.WRAPPER.MAP", Map.class));
 
         if (wrapperMap == null) {
             wrapperMap = new HashMap<QName, BindingOperationInfo>();
@@ -108,8 +106,7 @@ public final class ServiceModelUtil {
                     }
                 }
             }
-            service.setProperty("ServiceModel.WRAPPER.MAP"
-                                + (output ? "" : "_OUT"), wrapperMap);
+            service.setProperty(output ? "ServiceModel.WRAPPER.MAP_OUT" : "ServiceModel.WRAPPER.MAP",
wrapperMap);
         }
         return wrapperMap.get(opName);
     }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/AbstractDOMStreamReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/AbstractDOMStreamReader.java?rev=1456922&r1=1456921&r2=1456922&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/AbstractDOMStreamReader.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/AbstractDOMStreamReader.java Fri
Mar 15 12:18:14 2013
@@ -19,9 +19,7 @@
 package org.apache.cxf.staxutils;
 
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import javax.xml.stream.Location;
 import javax.xml.stream.XMLStreamConstants;
@@ -38,8 +36,6 @@ import javax.xml.stream.XMLStreamReader;
 public abstract class AbstractDOMStreamReader<T, I> implements XMLStreamReader {
     protected int currentEvent = XMLStreamConstants.START_DOCUMENT;
 
-    private Map<String, Object> properties = new HashMap<String, Object>();
-
     private FastStack<ElementFrame<T, I>> frames = new FastStack<ElementFrame<T,
I>>();
 
     private ElementFrame<T, I> frame;
@@ -118,7 +114,7 @@ public abstract class AbstractDOMStreamR
      * @see javax.xml.stream.XMLStreamReader#getProperty(java.lang.String)
      */
     public Object getProperty(String key) throws IllegalArgumentException {
-        return properties.get(key);
+        return null;
     }
 
     /*

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java?rev=1456922&r1=1456921&r2=1456922&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
Fri Mar 15 12:18:14 2013
@@ -76,7 +76,6 @@ public class PolicyOutInterceptor extend
             return;
         }
 
-        List<Interceptor<? extends Message>> interceptors = new ArrayList<Interceptor<?
extends Message>>();
         Collection<Assertion> assertions = new ArrayList<Assertion>();
 
         // 1. Check overridden policy
@@ -89,7 +88,7 @@ public class PolicyOutInterceptor extend
             PolicyUtils.logPolicy(LOG, Level.FINEST, "Using effective policy: ", 
                                   effectivePolicy.getPolicy());
             
-            interceptors.addAll(effectivePolicy.getInterceptors());
+            addInterceptors(effectivePolicy.getInterceptors(), msg);
             assertions.addAll(effectivePolicy.getChosenAlternative());
         } else if (MessageUtils.isRequestor(msg)) {
             // 2. Process client policy
@@ -102,7 +101,7 @@ public class PolicyOutInterceptor extend
                 PolicyUtils.logPolicy(
                     LOG, Level.FINEST, "Using effective policy: ", effectivePolicy.getPolicy()
                 );
-                interceptors.addAll(effectivePolicy.getInterceptors());
+                addInterceptors(effectivePolicy.getInterceptors(), msg);
                 assertions.addAll(effectivePolicy.getChosenAlternative());
             }
         } else {
@@ -117,18 +116,11 @@ public class PolicyOutInterceptor extend
                 PolicyUtils.logPolicy(
                     LOG, Level.FINEST, "Using effective policy: ", effectivePolicy.getPolicy()
                 );
-                interceptors.addAll(effectivePolicy.getInterceptors());
+                addInterceptors(effectivePolicy.getInterceptors(), msg);
                 assertions.addAll(effectivePolicy.getChosenAlternative());
             }
         }
         
-        // add interceptors into message chain
-        for (Interceptor<? extends Message> oi : interceptors) {
-            msg.getInterceptorChain().add(oi);
-            LOG.log(Level.FINE, "Added interceptor of type {0}",
-                    oi.getClass().getSimpleName());           
-        }
-
         // insert assertions of endpoint's fault vocabulary into message        
         if (null != assertions && !assertions.isEmpty()) {
             if (LOG.isLoggable(Level.FINEST)) {
@@ -145,4 +137,11 @@ public class PolicyOutInterceptor extend
             msg.getInterceptorChain().add(PolicyVerificationOutInterceptor.INSTANCE);
         }
     }
+    
+    private static void addInterceptors(List<Interceptor<? extends Message>>
interceptors, Message msg) {
+        for (Interceptor<? extends Message> oi : interceptors) {
+            msg.getInterceptorChain().add(oi);
+            LOG.log(Level.FINE, "Added interceptor of type {0}", oi.getClass().getSimpleName());
+        }
+    }
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java?rev=1456922&r1=1456921&r2=1456922&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
Fri Mar 15 12:18:14 2013
@@ -277,7 +277,9 @@ public abstract class AbstractBindingBui
         if (assertion == null) {
             return;
         }
-        LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + reason);
+        if (LOG.isLoggable(Level.FINE)) {
+            LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + reason);
+        }
         Collection<AssertionInfo> ais;
         ais = aim.get(assertion.getName());
         if (ais != null) {
@@ -296,7 +298,9 @@ public abstract class AbstractBindingBui
         if (assertion == null) {
             return;
         }
-        LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + reason);
+        if (LOG.isLoggable(Level.FINE)) {
+            LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + reason);
+        }
         Collection<AssertionInfo> ais;
         ais = aim.get(assertion.getName());
         if (ais != null) {
@@ -315,7 +319,9 @@ public abstract class AbstractBindingBui
         if (assertion == null) {
             return;
         }
-        LOG.log(Level.FINE, "Asserting " + assertion.getName());
+        if (LOG.isLoggable(Level.FINE)) {
+            LOG.log(Level.FINE, "Asserting " + assertion.getName());
+        }
         Collection<AssertionInfo> ais;
         ais = aim.get(assertion.getName());
         if (ais != null) {



Mime
View raw message