Author: remy.maucherat(a)jboss.com
Date: 2014-01-17 09:30:55 -0500 (Fri, 17 Jan 2014)
New Revision: 2345
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
Log:
Port WS patch: upgrade behavior tweaks.
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
===================================================================
---
branches/7.4.x/src/main/java/org/apache/tomcat/websocket/server/UpgradeUtil.java 2014-01-16
17:02:26 UTC (rev 2344)
+++
branches/7.4.x/src/main/java/org/apache/tomcat/websocket/server/UpgradeUtil.java 2014-01-17
14:30:55 UTC (rev 2345)
@@ -119,11 +119,8 @@
// 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
@@ -149,18 +146,6 @@
}
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();
@@ -178,6 +163,19 @@
}
}
+ 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);
+ }
+
// Small hack until the Servlet API provides a way to do this.
ServletRequest inner = req;
// Unwrap the request
Show replies by date