Author: markt
Date: Fri Jan 17 11:50:11 2014
New Revision: 1559081
URL: http://svn.apache.org/r1559081
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56025
Always call ServerEndpointConfig.Configurator.getNegotiatedSubprotocol()
CReate the EndPoint instance after calling
ServerEndpointConfig.Configurator.modifyHandshake()
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java?rev=1559081&r1=1559080&r2=1559081&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java Fri
Jan 17 11:50:11 2014
@@ -115,11 +115,8 @@ public class UpgradeUtil {
// Sub-protocols
List<String> subProtocols = getTokensFromHeader(req,
"Sec-WebSocket-Protocol");
- if (!subProtocols.isEmpty()) {
- subProtocol = sec.getConfigurator().
- getNegotiatedSubprotocol(
- sec.getSubprotocols(), subProtocols);
- }
+ subProtocol = sec.getConfigurator().getNegotiatedSubprotocol(
+ sec.getSubprotocols(), subProtocols);
// Extensions
// Currently no extensions are supported by this implementation
@@ -145,18 +142,6 @@ public class UpgradeUtil {
}
resp.setHeader("Sec-WebSocket-Extensions", sb.toString());
}
- Endpoint ep;
- try {
- Class<?> clazz = sec.getEndpointClass();
- if (Endpoint.class.isAssignableFrom(clazz)) {
- ep = (Endpoint) sec.getConfigurator().getEndpointInstance(
- clazz);
- } else {
- ep = new PojoEndpointServer();
- }
- } catch (InstantiationException e) {
- throw new ServletException(e);
- }
WsHandshakeRequest wsRequest = new WsHandshakeRequest(req);
WsHandshakeResponse wsResponse = new WsHandshakeResponse();
@@ -174,6 +159,19 @@ public class UpgradeUtil {
}
}
+ Endpoint ep;
+ try {
+ Class<?> clazz = sec.getEndpointClass();
+ if (Endpoint.class.isAssignableFrom(clazz)) {
+ ep = (Endpoint) sec.getConfigurator().getEndpointInstance(
+ clazz);
+ } else {
+ ep = new PojoEndpointServer();
+ }
+ } catch (InstantiationException e) {
+ throw new ServletException(e);
+ }
+
WsHttpUpgradeHandler wsHandler =
req.upgrade(WsHttpUpgradeHandler.class);
wsHandler.preInit(ep, perSessionServerEndpointConfig, sc, wsRequest,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]