diff --git a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextRequest.java b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextRequest.java index 6f6b911112b..fbf5d3275a5 100644 --- a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextRequest.java +++ b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextRequest.java @@ -696,7 +696,7 @@ public class ServletContextRequest extends ContextRequest if (getRequestedSessionId() == null || _coreSession == null) return false; //check requestedId (which may have worker suffix) against the actual session id - return getSessionManager().getSessionIdManager().getId(getRequestedSessionId()).equals(_coreSession.getId()); + return _coreSession.isValid() && getSessionManager().getSessionIdManager().getId(getRequestedSessionId()).equals(_coreSession.getId()); } @Override diff --git a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/Request.java b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/Request.java index 082e77f0537..e63daeaccf0 100644 --- a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/Request.java +++ b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/Request.java @@ -1511,7 +1511,7 @@ public class Request implements HttpServletRequest if (getRequestedSessionId() == null || _coreSession == null) return false; - return (_sessionManager.getSessionIdManager().getId(getRequestedSessionId()).equals(_coreSession.getId())); + return (_coreSession.isValid() && _sessionManager.getSessionIdManager().getId(getRequestedSessionId()).equals(_coreSession.getId())); } @Override