Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Auge2018-12-12 00:48:45 +0000
committerRaymond Auge2018-12-12 00:48:45 +0000
commitb432a496c7298714cedfee4c6ff435f40e512196 (patch)
tree2b6d7a1cea5ee7843e3d7dfc790bba86266166b5
parent06745b4298f5ad9dce5d680095cb8fea435587cd (diff)
downloadrt.equinox.bundles-b432a496c7298714cedfee4c6ff435f40e512196.tar.gz
rt.equinox.bundles-b432a496c7298714cedfee4c6ff435f40e512196.tar.xz
rt.equinox.bundles-b432a496c7298714cedfee4c6ff435f40e512196.zip
Bug 534964 - [http servlet] invalidation of container sessions is too aggressiveI20181214-1800
Signed-off-by: Raymond Auge <raymond.auge@liferay.com>
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpSessionAdaptor.java7
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpSessionTracker.java71
2 files changed, 14 insertions, 64 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpSessionAdaptor.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpSessionAdaptor.java
index 7a5a71052..2cfcd70ed 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpSessionAdaptor.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpSessionAdaptor.java
@@ -110,13 +110,6 @@ public class HttpSessionAdaptor implements HttpSession, Serializable {
}
controller.removeActiveSession(session);
-
- try {
- this.getSession().invalidate();
- }
- catch (IllegalStateException ise) {
- controller.getHttpServiceRuntime().log("Session already invalidated!", ise); //$NON-NLS-1$
- }
}
public void invokeSessionListeners (List<Class<? extends EventListener>> classes, EventListener listener) {
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpSessionTracker.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpSessionTracker.java
index e783b52df..2e1ef9e9b 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpSessionTracker.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpSessionTracker.java
@@ -15,13 +15,12 @@
package org.eclipse.equinox.http.servlet.internal.servlet;
-import java.util.*;
+import java.util.Collections;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import javax.servlet.http.*;
+import javax.servlet.http.HttpSession;
import org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl;
-import org.eclipse.equinox.http.servlet.internal.context.ContextController;
-import org.eclipse.equinox.http.servlet.internal.util.EventListeners;
import org.eclipse.equinox.http.servlet.session.HttpSessionInvalidator;
/**
@@ -42,63 +41,21 @@ public class HttpSessionTracker implements HttpSessionInvalidator {
return;
}
- for (HttpSessionAdaptor httpSessionAdaptor : httpSessionAdaptors) {
- ContextController contextController =
- httpSessionAdaptor.getController();
-
- EventListeners eventListeners =
- contextController.getEventListeners();
-
- List<HttpSessionListener> httpSessionListeners = eventListeners.get(
- HttpSessionListener.class);
-
- if (!httpSessionListeners.isEmpty()) {
- HttpSessionEvent httpSessionEvent = new HttpSessionEvent(
- httpSessionAdaptor);
-
- for (HttpSessionListener listener : httpSessionListeners) {
- try {
- listener.sessionDestroyed(httpSessionEvent);
- }
- catch (IllegalStateException ise) {
- // outer session is already invalidated
- }
- }
- }
-
- List<HttpSessionAttributeListener> httpSessionAttributeListeners =
- eventListeners.get(HttpSessionAttributeListener.class);
-
- if (!httpSessionAttributeListeners.isEmpty()) {
- Enumeration<String> enumeration =
- httpSessionAdaptor.getAttributeNames();
+ HttpSession parentSession = null;
- while (enumeration.hasMoreElements()) {
- HttpSessionBindingEvent httpSessionBindingEvent =
- new HttpSessionBindingEvent(
- httpSessionAdaptor, enumeration.nextElement());
+ for (HttpSessionAdaptor httpSessionAdaptor : httpSessionAdaptors) {
+ parentSession = httpSessionAdaptor.getSession();
- for (HttpSessionAttributeListener
- httpSessionAttributeListener :
- httpSessionAttributeListeners) {
+ httpSessionAdaptor.invalidate();
+ }
- httpSessionAttributeListener.attributeRemoved(
- httpSessionBindingEvent);
- }
- }
+ if (invalidateParent && parentSession != null) {
+ try {
+ parentSession.invalidate();
}
-
- contextController.removeActiveSession(
- httpSessionAdaptor.getSession());
-
- if (invalidateParent) {
- try {
- httpSessionAdaptor.getSession().invalidate();
- }
- catch (IllegalStateException ise) {
- httpServiceRuntime.log(
- "Session was already invalidated!", ise); //$NON-NLS-1$
- }
+ catch (IllegalStateException ise) {
+ httpServiceRuntime.log(
+ "Session was already invalidated!", ise); //$NON-NLS-1$
}
}
}

Back to the top