You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2017/12/30 22:04:39 UTC

wicket git commit: WICKET-6493 WebSocket SessionIds are wrong (HttpSession one used instead of Websocket one) + NPE if no HttpSession is found during Handshake Request

Repository: wicket
Updated Branches:
  refs/heads/master 869ff9265 -> 922d56236


WICKET-6493 WebSocket SessionIds are wrong (HttpSession one used instead of Websocket one) + NPE if no HttpSession is found during Handshake Request


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/922d5623
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/922d5623
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/922d5623

Branch: refs/heads/master
Commit: 922d56236157b3356c9eba7a43aed8c838b0b4e2
Parents: 869ff92
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Dec 31 00:04:04 2017 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sun Dec 31 00:04:04 2017 +0200

----------------------------------------------------------------------
 .../protocol/ws/api/AbstractWebSocketProcessor.java      | 11 +++++++++--
 .../ws/api/registry/IWebSocketConnectionRegistry.java    |  7 ++++---
 2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/922d5623/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java
index e546a23..ca3569d 100644
--- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java
+++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java
@@ -17,6 +17,7 @@
 package org.apache.wicket.protocol.ws.api;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
 
 import org.apache.wicket.Application;
 import org.apache.wicket.MarkupContainer;
@@ -95,13 +96,19 @@ public abstract class AbstractWebSocketProcessor implements IWebSocketProcessor
 	 * Constructor.
 	 *
 	 * @param request
-	 *      the http request that was used to create the TomcatWebSocketProcessor
+	 *      the http request that was used to create this {@link IWebSocketProcessor}
 	 * @param application
 	 *      the current Wicket Application
 	 */
 	public AbstractWebSocketProcessor(final HttpServletRequest request, final WebApplication application)
 	{
-		this.sessionId = request.getSession(true).getId();
+		final HttpSession httpSession = request.getSession(true);
+		if (httpSession == null)
+		{
+			throw new IllegalStateException("There is no HTTP Session bound. Without a session Wicket won't be " +
+					"able to find the stored page to update its components");
+		}
+		this.sessionId = httpSession.getId();
 		String pageId = request.getParameter("pageId");
 		this.resourceName = request.getParameter("resourceName");
 		if (Strings.isEmpty(pageId) && Strings.isEmpty(resourceName))

http://git-wip-us.apache.org/repos/asf/wicket/blob/922d5623/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/IWebSocketConnectionRegistry.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/IWebSocketConnectionRegistry.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/IWebSocketConnectionRegistry.java
index 0afaefa..2782a93 100644
--- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/IWebSocketConnectionRegistry.java
+++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/IWebSocketConnectionRegistry.java
@@ -32,7 +32,7 @@ public interface IWebSocketConnectionRegistry
 	 * @param application
 	 *      the web application to look in
 	 * @param sessionId
-	 *      the web socket client session id
+	 *      the http session id
 	 * @param key
 	 *      the web socket client key
 	 * @return the web socket connection used by a client from the specified coordinates
@@ -43,6 +43,7 @@ public interface IWebSocketConnectionRegistry
 	 * @param application
 	 *            the web application to look in
 	 * @param sessionId
+	 *            the http session id
 	 * @return collection of web socket connection used by a client with the given session id
 	 */
 	Collection<IWebSocketConnection> getConnections(Application application, String sessionId);
@@ -61,7 +62,7 @@ public interface IWebSocketConnectionRegistry
 	 * @param application
 	 *      the web application to look in
 	 * @param sessionId
-	 *      the web socket client session id
+	 *      the http session id
 	 * @param key
 	 *      the web socket client key
 	 * @param connection
@@ -75,7 +76,7 @@ public interface IWebSocketConnectionRegistry
 	 * @param application
 	 *      the web application to look in
 	 * @param sessionId
-	 *      the web socket client session id
+	 *      the http session id
 	 * @param key
 	 *      the web socket client key
 	 */