You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2017/04/06 23:38:04 UTC

cxf git commit: CXF-7276: Atmosphere init code should be moved out of AtmosphereWebSocketServlet Destination. Fixed base path configuration in case of wrapping JSR-356 Websockets

Repository: cxf
Updated Branches:
  refs/heads/master 8b78d8c82 -> b6a4763dc


CXF-7276: Atmosphere init code should be moved out of AtmosphereWebSocketServlet Destination. Fixed base path configuration in case of wrapping JSR-356 Websockets


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

Branch: refs/heads/master
Commit: b6a4763dc95c874004e600c78888796474f267b8
Parents: 8b78d8c
Author: reta <dr...@gmail.com>
Authored: Thu Apr 6 19:37:52 2017 -0400
Committer: reta <dr...@gmail.com>
Committed: Thu Apr 6 19:37:52 2017 -0400

----------------------------------------------------------------------
 .../AtmosphereWebSocketServletDestination.java  | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b6a4763d/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketServletDestination.java
----------------------------------------------------------------------
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketServletDestination.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketServletDestination.java
index f1c0cd6..2afd86c 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketServletDestination.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketServletDestination.java
@@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.http.DestinationRegistry;
 import org.apache.cxf.transport.servlet.ServletDestination;
@@ -118,6 +119,27 @@ public class AtmosphereWebSocketServletDestination extends ServletDestination im
                                HttpServletResponse resp) throws IOException {
         super.invoke(config, context, req, resp);
     }
+    
+    @Override
+    protected void setupMessage(Message inMessage, ServletConfig config, ServletContext context, 
+            HttpServletRequest req, HttpServletResponse resp) throws IOException {
+
+        super.setupMessage(inMessage, config, context, req, resp);
+        
+        // There are some complications with detecting a full request URL in JSR-356 spec, so
+        // every WS Container has different interpretation.
+        // 
+        //   https://bz.apache.org/bugzilla/show_bug.cgi?id=56573
+        //   https://java.net/jira/browse/WEBSOCKET_SPEC-228
+        //
+        // We have do manually inject the transport endpoint address, otherwise the
+        // JAX-RS resources won't be found.
+        final Object address = req.getAttribute("org.apache.cxf.transport.endpoint.address");
+        if (address == null) {
+            String basePath = (String)inMessage.get(Message.BASE_PATH);
+            req.setAttribute("org.apache.cxf.transport.endpoint.address", basePath);
+        }
+    }
 
     @Override
     public void shutdown() {