You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2014/12/19 15:36:14 UTC

cxf git commit: [CXF-6168] Applying a patch from lucaspouzac with minor modifications; This closes #45

Repository: cxf
Updated Branches:
  refs/heads/master 0822d75f5 -> 574455eec


[CXF-6168] Applying a patch from lucaspouzac with minor modifications; This closes #45


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

Branch: refs/heads/master
Commit: 574455eec5eddabce284e7ce8cbdb49f9bc81c8b
Parents: 0822d75
Author: Sergey Beryozkin <sb...@talend.com>
Authored: Fri Dec 19 14:35:57 2014 +0000
Committer: Sergey Beryozkin <sb...@talend.com>
Committed: Fri Dec 19 14:35:57 2014 +0000

----------------------------------------------------------------------
 .../transport/servlet/ServletController.java    | 47 ++++++++++++--------
 1 file changed, 29 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/574455ee/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
index 2fba820..817fb45 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
@@ -81,25 +81,36 @@ public class ServletController {
     protected void updateDestination(HttpServletRequest request,
                                      AbstractHTTPDestination d) {
         String base = getBaseURL(request);
-        synchronized (d) {
-            String ad = d.getEndpointInfo().getAddress();
-            if (ad == null 
-                && d.getAddress() != null
-                && d.getAddress().getAddress() != null) {
-                ad = d.getAddress().getAddress().getValue();
-                if (ad == null) {
-                    ad = "/";
-                }
+        if (disableAddressUpdates) {
+            updateDestination(request, base, d);
+        } else {
+            synchronized (d) {
+                updateDestination(request, base, d);
             }
-            // Using HTTP_PREFIX check is safe for ServletController
-            // URI.create(ad).isRelative() can be used - a bit more expensive though
-            if (ad != null && !ad.startsWith(HTTP_PREFIX)) {
-                if (disableAddressUpdates) {
-                    request.setAttribute("org.apache.cxf.transport.endpoint.address", 
-                                         base + ad);
-                } else {
-                    BaseUrlHelper.setAddress(d, base + ad);
-                }
+        }
+        
+    }
+    
+    protected void updateDestination(HttpServletRequest request,
+                                     String base,
+                                     AbstractHTTPDestination d) {
+        String ad = d.getEndpointInfo().getAddress();
+        if (ad == null 
+            && d.getAddress() != null
+            && d.getAddress().getAddress() != null) {
+            ad = d.getAddress().getAddress().getValue();
+            if (ad == null) {
+                ad = "/";
+            }
+        }
+        // Using HTTP_PREFIX check is safe for ServletController
+        // URI.create(ad).isRelative() can be used - a bit more expensive though
+        if (ad != null && !ad.startsWith(HTTP_PREFIX)) {
+            if (disableAddressUpdates) {
+                request.setAttribute("org.apache.cxf.transport.endpoint.address", 
+                                     base + ad);
+            } else {
+                BaseUrlHelper.setAddress(d, base + ad);
             }
         }
     }