Introduce killing a zombie RWT UI session
[lgpl/argeo-commons.git] / swt / rap / org.argeo.swt.specific.rap / src / org / argeo / eclipse / ui / specific / UiContext.java
index 72e17a22d7ea73f197cfd1be56d6af930e8567b0..698fe2080486b3efbd119ccfd5f8021dfa75151b 100644 (file)
@@ -4,17 +4,21 @@ import java.util.Locale;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSessionBindingListener;
 
 import org.eclipse.rap.rwt.RWT;
+import org.eclipse.rap.rwt.service.UISession;
 import org.eclipse.swt.widgets.Display;
 
 /** Singleton class providing single sources infos about the UI context. */
 public class UiContext {
        /** Can be null, thus indicating that we are not in a web context. */
+       @Deprecated
        public static HttpServletRequest getHttpRequest() {
                return RWT.getRequest();
        }
 
+       @Deprecated
        public static HttpServletResponse getHttpResponse() {
                return RWT.getResponse();
        }
@@ -49,6 +53,11 @@ public class UiContext {
                display.setData(key, value);
        }
 
+       public static void killDisplay(Display display) {
+               UISession uiSession = RWT.getUISession(display);
+               ((HttpSessionBindingListener) uiSession).valueUnbound(null);
+       }
+
        private static Display getDisplay() {
                return Display.getCurrent();
        }