git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/session-checker@119814 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-10-15 14:45:06 +00:00
parent 66d76106ab
commit 751717fe00
3 changed files with 26 additions and 5 deletions

View File

@ -1,7 +1,8 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets.widgets.sessionchecher.0-4-0"
date="2015-09-01">
date="2015-10-15">
<Change>Fixed typoe in html >(reload this page)</Change>
<Change>Further Check if in portal when getting ASL null, see Bug #708</Change>
</Changeset>
<Changeset component="org.gcube.portlets.widgets.sessionchecher.0-3-0"
date="2014-10-06">

View File

@ -24,7 +24,7 @@
</scm>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.5.1</gwtVersion>
<gwtVersion>2.7.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<!-- GWT needs at least java 1.6 -->
<maven.compiler.source>1.7</maven.compiler.source>
@ -48,6 +48,7 @@
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -60,9 +60,14 @@ public class SessionCheckerServiceImpl extends RemoteServiceServlet implements
}
}
catch (Exception e) {
_log.warn("Stopping session polling as you are in dev mode (am I wrong?)");
e.printStackTrace();
return new SessionInfoBean("","", true); //tells that you are in development mode
if (isWithinPortal()) {
_log.warn("Liferay Portal Detected but session Expired");
return new SessionInfoBean("",""); //tells session expired
}
else {
_log.warn("Stopping session polling as i think you are in development mode");
return new SessionInfoBean("","", true); //tells that you are in development mode
}
}
String user = session.getUsername();
String scope = session.getScope();
@ -77,4 +82,18 @@ public class SessionCheckerServiceImpl extends RemoteServiceServlet implements
return new SessionInfoBean(session.getUsername(), session.getScope());
}
/**
*
* @return true if you're running into the portal, false if in development
*/
private boolean isWithinPortal() {
try {
UserLocalServiceUtil.getService();
return true;
}
catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
_log.trace("Development Mode ON");
return false;
}
}
}