cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [1/3] git commit: [CXF-5752] Unable to find the target operation when using websocket transport without atmosphere
Date Tue, 20 May 2014 15:49:41 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 503663709 -> 1e7e0eeea


[CXF-5752] Unable to find the target operation when using websocket transport without atmosphere


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

Branch: refs/heads/master
Commit: 1e7e0eeeafa5453bfe12b24ae072044a136341ac
Parents: 34d892d
Author: Akitoshi Yoshida <ay@apache.org>
Authored: Tue May 20 17:47:56 2014 +0200
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Tue May 20 17:48:29 2014 +0200

----------------------------------------------------------------------
 .../websocket/WebSocketServletHolder.java          |  1 +
 .../websocket/WebSocketVirtualServletRequest.java  |  4 ++++
 .../atmosphere/AtmosphereWebSocketHandler.java     |  5 +++++
 .../transport/websocket/jetty/JettyWebSocket.java  | 17 +++++++++++++++--
 4 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1e7e0eee/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketServletHolder.java
----------------------------------------------------------------------
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketServletHolder.java
b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketServletHolder.java
index bd4dea9..8385fa8 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketServletHolder.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketServletHolder.java
@@ -54,5 +54,6 @@ public interface WebSocketServletHolder {
     ServletContext getServletContext();
     int getServerPort();
     Principal getUserPrincipal();
+    Object getAttribute(String name);
     void write(byte[] data, int offset, int length) throws IOException;
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/1e7e0eee/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketVirtualServletRequest.java
----------------------------------------------------------------------
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketVirtualServletRequest.java
b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketVirtualServletRequest.java
index 0f4e5ad..9f7bc1a 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketVirtualServletRequest.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketVirtualServletRequest.java
@@ -75,6 +75,10 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest
{
             throw new InvalidPathException();
         }
         this.attributes = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
+        Object v = websocket.getAttribute("org.apache.cxf.transport.endpoint.address");
+        if (v != null) {
+            attributes.put("org.apache.cxf.transport.endpoint.address", v);
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/1e7e0eee/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketHandler.java
----------------------------------------------------------------------
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketHandler.java
b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketHandler.java
index 6203234..2a786de 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketHandler.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketHandler.java
@@ -294,6 +294,11 @@ public class AtmosphereWebSocketHandler implements WebSocketProtocol
{
         }
 
         @Override
+        public Object getAttribute(String name) {
+            return webSocket.resource().getRequest().getAttribute(name);
+        }
+
+        @Override
         public void write(byte[] data, int offset, int length) throws IOException {
             webSocket.write(data, offset, length);
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/1e7e0eee/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/JettyWebSocket.java
----------------------------------------------------------------------
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/JettyWebSocket.java
b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/JettyWebSocket.java
index 4450a2b..1685338 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/JettyWebSocket.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/JettyWebSocket.java
@@ -27,6 +27,7 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
+import java.util.TreeMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -164,10 +165,17 @@ class JettyWebSocket implements WebSocket.OnBinaryMessage, WebSocket.OnTextMessa
     private static class JettyWebSocketServletHolder implements WebSocketServletHolder {
         private JettyWebSocket webSocket;
         private Map<String, Object> requestProperties;
-
+        private Map<String, Object> requestAttributes;
+        
         public JettyWebSocketServletHolder(JettyWebSocket webSocket, HttpServletRequest request)
{
             this.webSocket = webSocket;
             this.requestProperties = readProperties(request);
+            this.requestAttributes = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
+            // attributes that are needed for finding the operation in some cases
+            Object v = request.getAttribute("org.apache.cxf.transport.endpoint.address");
+            if (v != null) {
+                requestAttributes.put("org.apache.cxf.transport.endpoint.address", v);
+            }
         }
 
         @SuppressWarnings("unchecked")
@@ -200,7 +208,7 @@ class JettyWebSocket implements WebSocket.OnBinaryMessage, WebSocket.OnTextMessa
             properties.put("secure", request.isSecure());
             properties.put("authType", request.getAuthType());
             properties.put("dispatcherType", request.getDispatcherType());
-            
+
             return properties;
         }
 
@@ -320,6 +328,11 @@ class JettyWebSocket implements WebSocket.OnBinaryMessage, WebSocket.OnTextMessa
         }
 
         @Override
+        public Object getAttribute(String name) {
+            return requestAttributes.get(name);
+        }
+
+        @Override
         public void write(byte[] data, int offset, int length) throws IOException {
             webSocket.write(data, offset, length);
         }


Mime
View raw message