tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1422333 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsProtocolHandler.java
Date Sat, 15 Dec 2012 19:57:17 GMT
Author: markt
Date: Sat Dec 15 19:57:16 2012
New Revision: 1422333

URL: http://svn.apache.org/viewvc?rev=1422333&view=rev
Log:
Re-order so RemoteEndpoint is in place before onOpen is called as onOpen may create MessageHandlers
that call getRemote()

Modified:
    tomcat/trunk/java/org/apache/tomcat/websocket/WsProtocolHandler.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsProtocolHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsProtocolHandler.java?rev=1422333&r1=1422332&r2=1422333&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsProtocolHandler.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsProtocolHandler.java Sat Dec 15 19:57:16
2012
@@ -45,15 +45,6 @@ public class WsProtocolHandler implement
 
     @Override
     public void init(WebConnection connection) {
-        // Need to call onOpen using the web application's class loader
-        Thread t = Thread.currentThread();
-        ClassLoader cl = t.getContextClassLoader();
-        t.setContextClassLoader(applicationClassLoader);
-        try {
-            ep.onOpen(wsSession);
-        } finally {
-            t.setContextClassLoader(cl);
-        }
         ServletInputStream sis;
         ServletOutputStream sos;
         try {
@@ -67,6 +58,16 @@ public class WsProtocolHandler implement
         WsRemoteEndpoint wsRemoteEndpoint = new WsRemoteEndpoint(sos);
         wsSession.setRemote(wsRemoteEndpoint);
         sos.setWriteListener(new WsWriteListener(this, wsRemoteEndpoint));
+
+        // Need to call onOpen using the web application's class loader
+        Thread t = Thread.currentThread();
+        ClassLoader cl = t.getContextClassLoader();
+        t.setContextClassLoader(applicationClassLoader);
+        try {
+            ep.onOpen(wsSession);
+        } finally {
+            t.setContextClassLoader(cl);
+        }
     }
 
 



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


Mime
View raw message