From b447e80b662e69fb53b1496f52726f613a82f188 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Wed, 29 Mar 2017 14:09:36 +0000 Subject: [PATCH] added VHOST_TO_SKIP for "dev.d4science.org"; git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/liferay62-plugins/landing-page-hook@146430 82a268e6-3cf1-43bd-a215-b396298e98cf --- .project | 1 + .settings/org.eclipse.wst.common.component | 4 ++-- .../org/gcube/portal/events/LandingPageAction.java | 10 ++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.project b/.project index 9822942..e311efb 100644 --- a/.project +++ b/.project @@ -38,5 +38,6 @@ org.eclipse.m2e.core.maven2Nature org.eclipse.wst.common.project.facet.core.nature org.eclipse.wst.jsdt.core.jsNature + com.liferay.ide.core.liferayNature diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index a0e8b37..f045367 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,10 +1,10 @@ - + - + uses diff --git a/src/main/java/org/gcube/portal/events/LandingPageAction.java b/src/main/java/org/gcube/portal/events/LandingPageAction.java index 77ad78f..29fc175 100644 --- a/src/main/java/org/gcube/portal/events/LandingPageAction.java +++ b/src/main/java/org/gcube/portal/events/LandingPageAction.java @@ -19,7 +19,7 @@ import com.liferay.portal.kernel.util.WebKeys; public class LandingPageAction extends Action { private static final Logger _log = LoggerFactory.getLogger(LandingPageAction.class); - + private static final String VHOST_TO_SKIP = "dev.d4science.org"; @Override public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException { @@ -27,12 +27,18 @@ public class LandingPageAction extends Action { HttpSession session = request.getSession(); String path = ""; + String currentVirtualHost = ""; try { path = getCustomLandingPage(request); + currentVirtualHost = request.getServerName(); } catch (Exception e) { e.printStackTrace(); } - session.setAttribute(WebKeys.LAST_PATH, new LastPath(StringPool.BLANK, path)); + if (currentVirtualHost.compareTo(VHOST_TO_SKIP) != 0) + session.setAttribute(WebKeys.LAST_PATH, new LastPath(StringPool.BLANK, path)); + else { + _log.debug("Found VHOST_TO_SKIP = " + currentVirtualHost); + } } /** * Returns custom landing page path after user login