You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mp...@apache.org on 2018/04/18 10:24:23 UTC

[ambari] branch trunk updated: AMBARI-23470. None of the Ambari View works because of 'X-Frame-Options' to 'deny' error. (mpapirkovskyy)

This is an automated email from the ASF dual-hosted git repository.

mpapirkovskyy pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c867919  AMBARI-23470. None of the Ambari View works because of 'X-Frame-Options' to 'deny' error. (mpapirkovskyy)
c867919 is described below

commit c8679192b71f86604bd029eb22bedea6eeabb8df
Author: Myroslav Papirkovskyi <mp...@apache.org>
AuthorDate: Tue Apr 17 19:59:32 2018 +0300

    AMBARI-23470. None of the Ambari View works because of 'X-Frame-Options' to 'deny' error. (mpapirkovskyy)
---
 .../ambari/server/controller/AmbariHandlerList.java      |  1 +
 .../ambari/server/controller/AmbariHandlerListTest.java  | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

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 64278c9..e3ebc77 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
@@ -176,6 +176,7 @@ public class AmbariHandlerList extends HandlerCollection implements ViewInstance
         throw new SystemException("Caught exception adding a view instance.", e);
       }
     }
+    handler.getSessionHandler().setSessionCache(sessionHandler.getSessionCache());
   }
 
   @Override
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariHandlerListTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariHandlerListTest.java
index d528642..effdf9d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariHandlerListTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariHandlerListTest.java
@@ -44,6 +44,7 @@ import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.SessionIdManager;
+import org.eclipse.jetty.server.session.SessionCache;
 import org.eclipse.jetty.server.session.SessionHandler;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.webapp.WebAppContext;
@@ -62,6 +63,7 @@ public class AmbariHandlerListTest {
   private final SessionHandler sessionHandler = createNiceMock(SessionHandler.class);
   private final SessionIdManager sessionIdManager = createNiceMock(SessionIdManager.class);
   private final SessionHandlerConfigurer sessionHandlerConfigurer = createNiceMock(SessionHandlerConfigurer.class);
+  private final SessionCache sessionCache = createNiceMock(SessionCache.class);
 
 
   @Test
@@ -74,8 +76,11 @@ public class AmbariHandlerListTest {
 
     expect(handler.getServer()).andReturn(server);
     expect(handler.getChildHandlers()).andReturn(new Handler[]{});
+    expect(handler.getSessionHandler()).andReturn(createNiceMock(SessionHandler.class));
     handler.setServer(null);
 
+    expect(sessionHandler.getSessionCache()).andReturn(sessionCache);
+
     Capture<FilterHolder> securityHeaderFilterCapture = EasyMock.newCapture();
     Capture<FilterHolder> persistFilterCapture = EasyMock.newCapture();
     Capture<FilterHolder> securityFilterCapture = EasyMock.newCapture();
@@ -85,7 +90,7 @@ public class AmbariHandlerListTest {
     handler.addFilter(capture(securityFilterCapture), eq("/*"), eq(AmbariServer.DISPATCHER_TYPES));
     handler.setAllowNullPathInfo(true);
 
-    replay(handler, server);
+    replay(handler, server, sessionHandler);
 
     AmbariHandlerList handlerList = getAmbariHandlerList(handler);
 
@@ -99,7 +104,7 @@ public class AmbariHandlerListTest {
     Assert.assertEquals(persistFilter, persistFilterCapture.getValue().getFilter());
     Assert.assertEquals(springSecurityFilter, securityFilterCapture.getValue().getFilter());
 
-    verify(handler, server);
+    verify(handler, server, sessionHandler);
   }
 
   @Test
@@ -111,9 +116,12 @@ public class AmbariHandlerListTest {
 
     expect(handler.getServer()).andReturn(server);
     expect(handler.getChildHandlers()).andReturn(new Handler[]{});
+    expect(handler.getSessionHandler()).andReturn(createNiceMock(SessionHandler.class));
     handler.setServer(null);
 
-    replay(handler, server);
+    expect(sessionHandler.getSessionCache()).andReturn(sessionCache);
+
+    replay(handler, server, sessionHandler);
 
     AmbariHandlerList handlerList = getAmbariHandlerList(handler);
 
@@ -129,7 +137,7 @@ public class AmbariHandlerListTest {
 
     Assert.assertFalse(handlers.contains(handler));
 
-    verify(handler, server);
+    verify(handler, server, sessionHandler);
 
   }
 

-- 
To stop receiving notification emails like this one, please contact
mpapirkovskyy@apache.org.