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/06/30 11:27:33 UTC
svn commit: r1606653 - in /tomcat/trunk/java/org/apache/tomcat/websocket:
WsFrameClient.java WsRemoteEndpointImplBase.java WsWebSocketContainer.java
Author: markt
Date: Mon Jun 30 09:27:33 2014
New Revision: 1606653
URL: http://svn.apache.org/r1606653
Log:
Fix root cause of NPE when using WebSocket clients.
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java
tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java?rev=1606653&r1=1606652&r2=1606653&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java Mon Jun 30 09:27:33 2014
@@ -37,7 +37,10 @@ public class WsFrameClient extends WsFra
this.response = response;
this.channel = channel;
this.handler = new WsFrameClientCompletionHandler();
+ }
+
+ void startInputProcessing() {
try {
processSocketRead();
} catch (IOException e) {
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java?rev=1606653&r1=1606652&r2=1606653&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java Mon Jun 30 09:27:33 2014
@@ -260,9 +260,7 @@ public abstract class WsRemoteEndpointIm
messageParts.add(new MessagePart(opCode, payload, last,
new EndMessageHandler(this, handler)));
- if (transformation != null) {
- messageParts = transformation.sendMessagePart(messageParts);
- }
+ messageParts = transformation.sendMessagePart(messageParts);
MessagePart mp = messageParts.remove(0);
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1606653&r1=1606652&r2=1606653&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java Mon Jun 30 09:27:33 2014
@@ -316,8 +316,6 @@ public class WsWebSocketContainer
sm.getString("wsWebSocketContainer.httpRequestFailed"), e);
}
- // TODO Add extension/transformation support to the client
-
// Switch to WebSocket
WsRemoteEndpointImplClient wsRemoteEndpointClient = new WsRemoteEndpointImplClient(channel);
@@ -325,13 +323,17 @@ public class WsWebSocketContainer
this, null, null, null, null, null, subProtocol,
Collections.<String, String> emptyMap(), secure,
clientEndpointConfiguration);
- endpoint.onOpen(wsSession, clientEndpointConfiguration);
- registerSession(endpoint, wsSession);
- // Object creation will trigger input processing
- @SuppressWarnings("unused")
WsFrameClient wsFrameClient = new WsFrameClient(response, channel,
wsSession);
+ // WsFrame adds the necessary final transformations. Copy the
+ // completed transformation chain to the remote end point.
+ wsRemoteEndpointClient.setTransformation(wsFrameClient.getTransformation());
+
+ endpoint.onOpen(wsSession, clientEndpointConfiguration);
+ registerSession(endpoint, wsSession);
+
+ wsFrameClient.startInputProcessing();
return wsSession;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org