This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 2a38a7c34c Remove deprecated code
2a38a7c34c is described below
commit 2a38a7c34ca8897bd543851bcec413dda95b4c3c
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Oct 30 12:47:31 2026 +0000
Remove deprecated code
---
java/org/apache/tomcat/websocket/WsSession.java | 31 +++++-----------------
.../websocket/server/WsHttpUpgradeHandler.java | 7 +----
2 files changed, 7 insertions(+), 31 deletions(-)
diff --git a/java/org/apache/tomcat/websocket/WsSession.java
b/java/org/apache/tomcat/websocket/WsSession.java
index 1569654e0f..3f27a2ab11 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -104,7 +104,6 @@ public class WsSession implements Session {
private final String subProtocol;
private final Map<String,String> pathParameters;
private final boolean secure;
- private final String httpSessionId;
private final String id;
// Expected to handle message types of <String> only
@@ -158,7 +157,6 @@ public class WsSession implements Session {
this.requestParameterMap = Collections.emptyMap();
this.queryString = null;
this.userPrincipal = null;
- this.httpSessionId = null;
this.negotiatedExtensions = negotiatedExtensions;
this.subProtocol = Objects.requireNonNullElse(subProtocol, "");
this.pathParameters = pathParameters;
@@ -192,8 +190,6 @@ public class WsSession implements Session {
* <code>null</code> if this is a client
session
* @param userPrincipal The principal associated with the request
that initiated this session or
* <code>null</code> if this is a client
session
- * @param httpSessionId The HTTP session ID associated with the
request that initiated this session or
- * <code>null</code> if this is a client
session
* @param negotiatedExtensions The agreed extensions to use for this
session
* @param subProtocol The agreed sub-protocol to use for this
session
* @param pathParameters The path parameters associated with the
request that initiated this session or
@@ -205,9 +201,8 @@ public class WsSession implements Session {
*/
public WsSession(WsRemoteEndpointImplBase wsRemoteEndpoint,
WsWebSocketContainer wsWebSocketContainer,
URI requestUri, Map<String,List<String>> requestParameterMap,
String queryString, Principal userPrincipal,
- String httpSessionId, List<Extension> negotiatedExtensions, String
subProtocol,
- Map<String,String> pathParameters, boolean secure,
ServerEndpointConfig serverEndpointConfig)
- throws DeploymentException {
+ List<Extension> negotiatedExtensions, String subProtocol,
Map<String,String> pathParameters, boolean secure,
+ ServerEndpointConfig serverEndpointConfig) throws
DeploymentException {
this.wsRemoteEndpoint = wsRemoteEndpoint;
this.wsRemoteEndpoint.setSession(this);
@@ -223,7 +218,6 @@ public class WsSession implements Session {
this.requestParameterMap =
Objects.requireNonNullElse(requestParameterMap, Collections.emptyMap());
this.queryString = queryString;
this.userPrincipal = userPrincipal;
- this.httpSessionId = httpSessionId;
this.negotiatedExtensions = negotiatedExtensions;
this.subProtocol = Objects.requireNonNullElse(subProtocol, "");
this.pathParameters = pathParameters;
@@ -560,8 +554,8 @@ public class WsSession implements Session {
/**
- * RFC 6455, sections 5.5.1 and 7.4.2. Need internal close method as spec
requires that the local endpoint
- * receives a 1006 on timeout.
+ * RFC 6455, sections 5.5.1 and 7.4.2. Need internal close method as spec
requires that the local endpoint receives
+ * a 1006 on timeout.
*
* @param closeReasonMessage The close reason to pass to the remote
endpoint
* @param closeReasonLocal The close reason to pass to the local endpoint
@@ -572,8 +566,8 @@ public class WsSession implements Session {
/**
- * RFC 6455, sections 5.5.1 and 7.4.2. Need internal close method as spec
requires that the local endpoint
- * receives a 1006 on timeout.
+ * RFC 6455, sections 5.5.1 and 7.4.2. Need internal close method as spec
requires that the local endpoint receives
+ * a 1006 on timeout.
*
* @param closeReasonMessage The close reason to pass to the remote
endpoint
* @param closeReasonLocal The close reason to pass to the local endpoint
@@ -1001,19 +995,6 @@ public class WsSession implements Session {
}
- /**
- * Returns the HTTP session ID associated with this WebSocket session at
the time the WebSocket session was created.
- *
- * @return the HTTP session ID, or null if not associated
- *
- * @deprecated Unused. Will be removed from Tomcat 12 onwards
- */
- @Deprecated
- public String getHttpSessionId() {
- return httpSessionId;
- }
-
-
/**
* Returns the text message handler for this session.
*
diff --git a/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java
b/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java
index 28205688a9..9158bcd334 100644
--- a/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java
+++ b/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java
@@ -21,7 +21,6 @@ import java.io.IOException;
import java.util.List;
import java.util.Map;
-import jakarta.servlet.http.HttpSession;
import jakarta.servlet.http.WebConnection;
import jakarta.websocket.CloseReason;
import jakarta.websocket.CloseReason.CloseCodes;
@@ -120,11 +119,7 @@ public class WsHttpUpgradeHandler implements
InternalHttpUpgradeHandler {
throw new
IllegalStateException(sm.getString("wsHttpUpgradeHandler.noPreInit"));
}
- String httpSessionId = null;
Object session = handshakeRequest.getHttpSession();
- if (session != null) {
- httpSessionId = ((HttpSession) session).getId();
- }
// Need to call onOpen using the web application's class loader
// Create the frame using the application's class loader so it can pick
@@ -137,7 +132,7 @@ public class WsHttpUpgradeHandler implements
InternalHttpUpgradeHandler {
new WsRemoteEndpointImplServer(socketWrapper, upgradeInfo,
webSocketContainer, connection);
wsSession = new WsSession(wsRemoteEndpointServer,
webSocketContainer, handshakeRequest.getRequestURI(),
handshakeRequest.getParameterMap(),
handshakeRequest.getQueryString(),
- handshakeRequest.getUserPrincipal(), httpSessionId,
negotiatedExtensions, subProtocol,
+ handshakeRequest.getUserPrincipal(), negotiatedExtensions,
subProtocol,
pathParameters, secure, serverEndpointConfig);
ep = wsSession.getLocal();
wsFrame = new WsFrameServer(socketWrapper, upgradeInfo, wsSession,
transformation, applicationClassLoader);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]