Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRĂ¼diger Herrmann2010-05-13 22:52:50 +0000
committerRĂ¼diger Herrmann2010-05-13 22:52:50 +0000
commit0512ec399a2cdcf78a4f19d7b12300077dc6b537 (patch)
tree71333852394f1784f37377cda454d61c72167054 /bundles/org.eclipse.rap.jettycustomizer/src/org/eclipse/rap/jettycustomizer/internal
parent5cae80d363dc4cde4d4db75390dc6e0893f98f84 (diff)
downloadorg.eclipse.rap-0512ec399a2cdcf78a4f19d7b12300077dc6b537.tar.gz
org.eclipse.rap-0512ec399a2cdcf78a4f19d7b12300077dc6b537.tar.xz
org.eclipse.rap-0512ec399a2cdcf78a4f19d7b12300077dc6b537.zip
Initial import
Diffstat (limited to 'bundles/org.eclipse.rap.jettycustomizer/src/org/eclipse/rap/jettycustomizer/internal')
-rw-r--r--bundles/org.eclipse.rap.jettycustomizer/src/org/eclipse/rap/jettycustomizer/internal/SessionCookieCustomizer.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/bundles/org.eclipse.rap.jettycustomizer/src/org/eclipse/rap/jettycustomizer/internal/SessionCookieCustomizer.java b/bundles/org.eclipse.rap.jettycustomizer/src/org/eclipse/rap/jettycustomizer/internal/SessionCookieCustomizer.java
new file mode 100644
index 0000000000..7b483ddc68
--- /dev/null
+++ b/bundles/org.eclipse.rap.jettycustomizer/src/org/eclipse/rap/jettycustomizer/internal/SessionCookieCustomizer.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 CAS Software AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CAS Software AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.rap.jettycustomizer.internal;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.http.jetty.JettyCustomizer;
+import org.mortbay.jetty.SessionManager;
+import org.mortbay.jetty.servlet.AbstractSessionManager;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.SessionHandler;
+
+/**
+ * Configure Jetty to not use cookies for session managment. This allows RAP
+ * applications to run in multiple tabs of the same browser instance.
+ */
+public final class SessionCookieCustomizer extends JettyCustomizer {
+
+ public Object customizeContext( final Object context,
+ final Dictionary settings )
+ {
+ Object result = super.customizeContext( context, settings );
+ customizeSessionManager( result );
+ return result;
+ }
+
+ private static void customizeSessionManager( Object context ) {
+ if( context instanceof Context ) {
+ Context jettyContext = ( Context )context;
+ SessionHandler sessionHandler = jettyContext.getSessionHandler();
+ if( sessionHandler != null ) {
+ SessionManager sessionManager = sessionHandler.getSessionManager();
+ if( sessionManager instanceof AbstractSessionManager ) {
+ ( ( AbstractSessionManager )sessionManager ).setUsingCookies( false );
+ }
+ }
+ }
+ }
+}

Back to the top