ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [11/27] git commit: AMBARI-7289 - Views : Delete view instance causes auto sign out
Date Tue, 16 Sep 2014 12:50:51 GMT
AMBARI-7289 - Views : Delete view instance causes auto sign out


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/002a190f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/002a190f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/002a190f

Branch: refs/heads/branch-alerts-dev
Commit: 002a190fc42752c5a695f29bfc5fb5e1ecbf0052
Parents: 02e9fdb
Author: tbeerbower <tbeerbower@hortonworks.com>
Authored: Fri Sep 12 17:54:33 2014 -0400
Committer: tbeerbower <tbeerbower@hortonworks.com>
Committed: Mon Sep 15 13:19:43 2014 -0400

----------------------------------------------------------------------
 .../server/controller/AmbariHandlerList.java    | 33 +++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/002a190f/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java
index 6a831f8..da15a66 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java
@@ -32,6 +32,7 @@ import org.apache.ambari.view.SystemException;
 import org.apache.ambari.view.ViewContext;
 import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.SessionManager;
+import org.eclipse.jetty.server.session.SessionHandler;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.webapp.WebAppContext;
 import org.springframework.web.context.WebApplicationContext;
@@ -91,7 +92,7 @@ public class AmbariHandlerList extends FailsafeHandlerList implements ViewInstan
         context.setClassLoader(viewInstanceDefinition.getViewEntity().getClassLoader());
         context.setAttribute(ViewContext.CONTEXT_ATTRIBUTE, new ViewContextImpl(viewInstanceDefinition,
viewRegistry));
 
-        context.getSessionHandler().setSessionManager(sessionManager);
+        context.setSessionHandler(new SharedSessionHandler(sessionManager));
         context.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
springWebAppContext);
         context.addFilter(new FilterHolder(springSecurityFilter), "/*", 1);
 
@@ -142,6 +143,7 @@ public class AmbariHandlerList extends FailsafeHandlerList implements
ViewInstan
   public void removeViewInstance(ViewInstanceEntity viewInstanceDefinition) {
     Handler handler = handlerMap.get(viewInstanceDefinition);
     if (handler != null) {
+      handlerMap.remove(viewInstanceDefinition);
       removeHandler(handler);
     }
   }
@@ -181,4 +183,33 @@ public class AmbariHandlerList extends FailsafeHandlerList implements
ViewInstan
      */
     public Handler create(ViewInstanceEntity viewInstanceDefinition, String webApp, String
contextPath);
   }
+
+
+  // ----- inner class : SharedSessionHandler --------------------------------
+
+  /**
+   * A session handler that shares its session manager with another app.
+   * This handler DOES NOT attempt stop the shared session manager.
+   */
+  private static class SharedSessionHandler extends SessionHandler {
+
+    // ----- Constructors ----------------------------------------------------
+
+    /**
+     * Construct a SharedSessionHandler.
+     *
+     * @param manager  the shared session manager.
+     */
+    public SharedSessionHandler(SessionManager manager) {
+      super(manager);
+    }
+
+
+    // ----- SessionHandler --------------------------------------------------
+
+    @Override
+    protected void doStop() throws Exception {
+      // do nothing...
+    }
+  }
 }


Mime
View raw message