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 2014/04/24 10:08:05 UTC
svn commit: r1589630 - in /tomcat/trunk:
java/org/apache/tomcat/websocket/pojo/PojoEndpointBase.java
webapps/docs/changelog.xml
Author: markt
Date: Thu Apr 24 08:08:05 2014
New Revision: 1589630
URL: http://svn.apache.org/r1589630
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56449
When creating a new session, add the message handlers to the session before calling Endpoint.onOpen() so the message handlers are in place should the onOpen() method trigger the sending of any messages.
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoEndpointBase.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoEndpointBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoEndpointBase.java?rev=1589630&r1=1589629&r2=1589630&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoEndpointBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoEndpointBase.java Thu Apr 24 08:08:05 2014
@@ -53,6 +53,14 @@ public abstract class PojoEndpointBase e
Object pojo = getPojo();
Map<String,String> pathParameters = getPathParameters();
+ // Add message handlers before calling onOpen since that may trigger a
+ // message which in turn could trigger a response and/or close the
+ // session
+ for (MessageHandler mh : methodMapping.getMessageHandlers(pojo,
+ pathParameters, session, config)) {
+ session.addMessageHandler(mh);
+ }
+
if (methodMapping.getOnOpen() != null) {
try {
methodMapping.getOnOpen().invoke(pojo,
@@ -75,11 +83,6 @@ public abstract class PojoEndpointBase e
return;
}
}
-
- for (MessageHandler mh : methodMapping.getMessageHandlers(pojo,
- pathParameters, session, config)) {
- session.addMessageHandler(mh);
- }
}
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1589630&r1=1589629&r2=1589630&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Apr 24 08:08:05 2014
@@ -228,6 +228,12 @@
client connections initiated by web applications but stand alone clients
must call <code>WsWebSocketContainer.destroy()</code>. (markt)
</fix>
+ <fix>
+ <bug>56449</bug>: When creating a new session, add the message handlers
+ to the session before calling <code>Endpoint.onOpen()</code> so the
+ message handlers are in place should the <code>onOpen()</code> method
+ trigger the sending of any messages. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Web applications">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org