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
This commit is contained in:
Massimiliano Assante 2017-03-29 14:09:36 +00:00
parent d56391890d
commit b447e80b66
3 changed files with 11 additions and 4 deletions

View File

@ -38,5 +38,6 @@
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.liferay.ide.core.liferayNature</nature>
</natures>
</projectDescription>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="landing-page-hook">
<wb-module deploy-name="landing-page-hook-hook">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="landing-page-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/landing-page-library/landing-page-library">
<dependent-module archiveName="landing-page-library-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/landing-page-library/landing-page-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="landing-page-hook"/>

View File

@ -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