You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/10/28 13:52:53 UTC

svn commit: r1536340 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/websocket/server/UpgradeUtil.java java/org/apache/tomcat/websocket/server/WsPerSessionServerEndpointConfig.java webapps/docs/changelog.xml

Author: markt
Date: Mon Oct 28 12:52:53 2013
New Revision: 1536340

URL: http://svn.apache.org/r1536340
Log:
Provide modifyHandshake() with a per session (i.e. per connection) view of the user properties rather than a per endpoint view (that would be shared will all connections to that endpoint).
This allows for easier configuration of per connection properties from within modifyHandshake()

Added:
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsPerSessionServerEndpointConfig.java
      - copied, changed from r1536337, tomcat/trunk/java/org/apache/tomcat/websocket/server/WsPerSessionServerEndpointConfig.java
Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1536337

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java?rev=1536340&r1=1536339&r2=1536340&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java Mon Oct 28 12:52:53 2013
@@ -162,7 +162,10 @@ public class UpgradeUtil {
 
         WsHandshakeRequest wsRequest = new WsHandshakeRequest(req);
         WsHandshakeResponse wsResponse = new WsHandshakeResponse();
-        sec.getConfigurator().modifyHandshake(sec, wsRequest, wsResponse);
+        WsPerSessionServerEndpointConfig perSessionServerEndpointConfig =
+                new WsPerSessionServerEndpointConfig(sec);
+        sec.getConfigurator().modifyHandshake(perSessionServerEndpointConfig,
+                wsRequest, wsResponse);
         wsRequest.finished();
 
         // Add any additional headers
@@ -182,8 +185,8 @@ public class UpgradeUtil {
         if (inner instanceof RequestFacade) {
             WsHttpUpgradeHandler wsHandler =
                     ((RequestFacade) inner).upgrade(WsHttpUpgradeHandler.class);
-            wsHandler.preInit(ep, sec, sc, wsRequest, subProtocol,
-                    pathParams, req.isSecure());
+            wsHandler.preInit(ep, perSessionServerEndpointConfig, sc, wsRequest,
+                    subProtocol, pathParams, req.isSecure());
         } else {
             throw new ServletException("Upgrade failed");
         }

Copied: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsPerSessionServerEndpointConfig.java (from r1536337, tomcat/trunk/java/org/apache/tomcat/websocket/server/WsPerSessionServerEndpointConfig.java)
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsPerSessionServerEndpointConfig.java?p2=tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsPerSessionServerEndpointConfig.java&p1=tomcat/trunk/java/org/apache/tomcat/websocket/server/WsPerSessionServerEndpointConfig.java&r1=1536337&r2=1536340&rev=1536340&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/server/WsPerSessionServerEndpointConfig.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsPerSessionServerEndpointConfig.java Mon Oct 28 12:52:53 2013
@@ -35,7 +35,7 @@ class WsPerSessionServerEndpointConfig i
 
     private final ServerEndpointConfig perEndpointConfig;
     private final Map<String,Object> perSessionUserProperties =
-            new ConcurrentHashMap<>();
+            new ConcurrentHashMap<String,Object>();
 
     WsPerSessionServerEndpointConfig(ServerEndpointConfig perEndpointConfig) {
         this.perEndpointConfig = perEndpointConfig;

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1536340&r1=1536339&r2=1536340&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Oct 28 12:52:53 2013
@@ -81,8 +81,16 @@
       <fix>
           Updated servlet spec version and documentation section-number reported
           when JAR files are rejected for containing a trigger class
-          (e.g. javax.servlet.Servlet).
+          (e.g. javax.servlet.Servlet). (schultz)
       </fix>
+      <add>
+        Modify the WebSocket handshake process so that the user properties
+        <code>Map</code> exposed by the <code>ServerEndpointConfig</code> during
+        the call to <code>Configurator.modifyHandshake()</code> is unique to the
+        connection rather than shared by all connections associated with the
+        Endpoint. This allows for easier configuration of per connection
+        properties from within <code>modifyHandshake()</code>. (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org