cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1001521 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ systests/j...
Date Sun, 26 Sep 2010 21:22:05 GMT
Author: sergeyb
Date: Sun Sep 26 21:22:04 2010
New Revision: 1001521

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

........
  r1001520 | sergeyb | 2010-09-26 22:19:09 +0100 (Sun, 26 Sep 2010) | 1 line
  
  [CXF-2997] : Prototyping the initial fix, setting a current base address as HttpServletRequest
attribute
........

Added:
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSOverlappingDestinationsTest.java
      - copied unchanged from r1001520, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSOverlappingDestinationsTest.java
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_many_destinations/
      - copied from r1001520, cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_many_destinations/
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_many_destinations/WEB-INF/
      - copied from r1001520, cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_many_destinations/WEB-INF/
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_many_destinations/WEB-INF/beans.xml
      - copied unchanged from r1001520, cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_many_destinations/WEB-INF/beans.xml
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_many_destinations/WEB-INF/web.xml
      - copied unchanged from r1001520, cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_many_destinations/WEB-INF/web.xml
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/SecurityContextImpl.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Sep 26 21:22:04 2010
@@ -1 +1 @@
-/cxf/trunk:998736
+/cxf/trunk:998736,1001520

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

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/SecurityContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/SecurityContextImpl.java?rev=1001521&r1=1001520&r2=1001521&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/SecurityContextImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/SecurityContextImpl.java
Sun Sep 26 21:22:04 2010
@@ -24,6 +24,7 @@ import java.security.Principal;
 import javax.ws.rs.core.SecurityContext;
 
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.jaxrs.utils.HttpUtils;
 import org.apache.cxf.message.Message;
 
 public class SecurityContextImpl implements SecurityContext {
@@ -50,8 +51,7 @@ public class SecurityContextImpl impleme
 
     
     public boolean isSecure() {
-        String value = m.getExchange().getDestination().getAddress()
-            .getAddress().getValue();
+        String value = HttpUtils.getEndpointAddress(m);
         return value.startsWith("https://");
     }
 

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java?rev=1001521&r1=1001520&r2=1001521&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
Sun Sep 26 21:22:04 2010
@@ -48,6 +48,7 @@ import org.apache.cxf.jaxrs.impl.HttpHea
 import org.apache.cxf.jaxrs.impl.PathSegmentImpl;
 import org.apache.cxf.jaxrs.model.ParameterType;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
 
@@ -207,7 +208,11 @@ public final class HttpUtils {
         Destination d = m.getExchange().getDestination();
         if (d != null) {
             if (d instanceof AbstractHTTPDestination) {
-                address = ((AbstractHTTPDestination)d).getEndpointInfo().getAddress();
+                EndpointInfo ei = ((AbstractHTTPDestination)d).getEndpointInfo();
+                HttpServletRequest request = (HttpServletRequest)m.get(AbstractHTTPDestination.HTTP_REQUEST);

+                Object property = request != null 
+                    ? request.getAttribute("org.apache.cxf.transport.endpoint.address") :
null;
+                address = property != null ? property.toString() : ei.getAddress();
             } else {
                 address = d.getAddress().getAddress().getValue();
             }

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java?rev=1001521&r1=1001520&r2=1001521&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java
Sun Sep 26 21:22:04 2010
@@ -46,6 +46,8 @@ public abstract class AbstractCXFServlet
     protected ServletTransportFactory servletTransportFactory;
     protected ServletController controller;
     
+    private boolean disableAddressUpdates;
+        
     public static Logger getLogger() {
         return LogUtils.getL7dLogger(AbstractCXFServlet.class);
     }
@@ -56,6 +58,10 @@ public abstract class AbstractCXFServlet
                                   servletConfig,
                                   this.getServletContext(), 
                                   bus);
+    
+        if (servletConfig.getInitParameter("disable-address-updates") == null) {
+            newController.setDisableAddressUpdates(disableAddressUpdates);
+        }
         
         return newController;
     }
@@ -145,4 +151,10 @@ public abstract class AbstractCXFServlet
         }
     }
 
+    // this makes it a bit easier to disable the address 
+    // updates when creating servlets programmatically
+    public void setDisableAddressUpdates(boolean disableAddressUpdates) {
+        this.disableAddressUpdates = disableAddressUpdates;
+    }
+    
 }

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=1001521&r1=1001520&r2=1001521&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Sun Sep 26 21:22:04 2010
@@ -77,9 +77,7 @@ public class ServletController extends A
     }
     
     protected synchronized void updateDests(HttpServletRequest request) {
-        if (disableAddressUpdates) {
-            return;
-        }
+        
         String base = forcedBaseAddress == null ? getBaseURL(request) : forcedBaseAddress;
                 
         if (base.equals(lastBase)) {
@@ -97,12 +95,19 @@ public class ServletController extends A
             if (ad != null 
                 && (ad.equals(path)
                 || ad.equals(lastBase + path))) {
-                d2.getEndpointInfo().setAddress(base + path);
-                if (d2.getEndpointInfo().getExtensor(AddressType.class) != null) {
-                    d2.getEndpointInfo().getExtensor(AddressType.class).setLocation(base
+ path);
+                if (disableAddressUpdates) {
+                    request.setAttribute("org.apache.cxf.transport.endpoint.address", base
+ path);
+                } else {
+                    d2.getEndpointInfo().setAddress(base + path);
+                    if (d2.getEndpointInfo().getExtensor(AddressType.class) != null) {
+                        d2.getEndpointInfo().getExtensor(AddressType.class).setLocation(base
+ path);
+                    }
                 }
             }
         }
+        if (disableAddressUpdates) {
+            return;
+        }
         lastBase = base;
     }
 



Mime
View raw message