cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1292050 - in /cxf/branches/2.5.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
Date Tue, 21 Feb 2012 21:54:55 GMT
Author: sergeyb
Date: Tue Feb 21 21:54:55 2012
New Revision: 1292050

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

........
  r1291943 | sergeyb | 2012-02-21 18:00:31 +0000 (Tue, 21 Feb 2012) | 1 line
  
  Minimizing a number of HttpUtils.getPathToMatch calls
........

Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:1291943

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

Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java?rev=1292050&r1=1292049&r2=1292050&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
Tue Feb 21 21:54:55 2012
@@ -56,10 +56,13 @@ public final class HttpUtils {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(HttpUtils.class);
     private static final Logger LOG = LogUtils.getL7dLogger(HttpUtils.class);
     
+    private static final String REQUEST_PATH_TO_MATCH = "path_to_match";
+    private static final String REQUEST_PATH_TO_MATCH_SLASH = "path_to_match_slash";
+    
     private static final String ANY_IP_ADDRESS = "0.0.0.0";
     private static final String ANY_IP_ADDRESS_START = "://0.0.0.0";
     private static final int DEFAULT_HTTP_PORT = 80;
-    
+        
     private static final Pattern ENCODE_PATTERN = Pattern.compile("%[0-9a-fA-F][0-9a-fA-F]");
     private static final String CHARSET_PARAMETER = "charset";
     
@@ -204,9 +207,16 @@ public final class HttpUtils {
     }
     
     public static String getPathToMatch(Message m, boolean addSlash) {
+        String var = addSlash ? REQUEST_PATH_TO_MATCH_SLASH : REQUEST_PATH_TO_MATCH;
+        String pathToMatch = (String)m.get(var);
+        if (pathToMatch != null) {
+            return pathToMatch; 
+        }
         String requestAddress = getProtocolHeader(m, Message.REQUEST_URI, "/");
         String baseAddress = getBaseAddress(m);
-        return getPathToMatch(requestAddress, baseAddress, addSlash);
+        pathToMatch = getPathToMatch(requestAddress, baseAddress, addSlash);
+        m.put(var, pathToMatch);
+        return pathToMatch;
     }
     
     public static String getProtocolHeader(Message m, String name, String defaultValue) {
@@ -260,6 +270,8 @@ public final class HttpUtils {
             path = "/" + path;
         }
         m.put(Message.REQUEST_URI, baseAddress + path);
+        m.remove(REQUEST_PATH_TO_MATCH);
+        m.remove(REQUEST_PATH_TO_MATCH_SLASH);
     }
 
     



Mime
View raw message