added ClientScopeHandler to help prevent the back button cache problem in Chrome and Firefox

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gcube-loggedin@102001 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-12-11 17:38:17 +00:00
parent ecccd2a67c
commit 3d2f743533
10 changed files with 70 additions and 49 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/gcube-loggedin-2.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/gcube-loggedin-2.5.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -31,5 +31,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/gcube-loggedin-2.5.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/gcube-loggedin-2.5.1-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,5 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/Users/massi/Documents/workspace/gcube-loggedin/target/gcube-loggedin-2.5.0-SNAPSHOT
lastWarOutDir=/Users/massi/Documents/workspace/gcube-loggedin/target/gcube-loggedin-2.5.1-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -3,6 +3,9 @@
<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"/>
<dependent-module archiveName="gcube-widgets-1.9.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="session-checker-0.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
<dependency-type>uses</dependency-type>
</dependent-module>

View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-loggedin</artifactId>
<packaging>war</packaging>
<version>2.5.0-SNAPSHOT</version>
<version>2.5.1-SNAPSHOT</version>
<name>gCube Loggedin Portlet</name>
<description>
@ -66,7 +66,7 @@
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId>
<scope>provided</scope>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>

View File

@ -5,6 +5,7 @@ import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window.Location;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.HTML;
@ -35,7 +36,7 @@ public class GCubeLoggedin implements EntryPoint {
// Associate the new panel with the HTML host page.
RootPanel.get("LoggedinDiv").add(main_panel);
loggedinService.getSelectedRE(new AsyncCallback<VObject>() {
loggedinService.getSelectedRE(Location.getHref(), new AsyncCallback<VObject>() {
public void onFailure(Throwable caught) { }
public void onSuccess(VObject result) {

View File

@ -11,7 +11,7 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@RemoteServiceRelativePath("LoggedinServiceImpl")
public interface LoggedinService extends RemoteService {
VObject getSelectedRE();
VObject getSelectedRE(String portalURL);
String getDefaultCommunityURL();

View File

@ -10,7 +10,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
public interface LoggedinServiceAsync {
void getSelectedRE(AsyncCallback<VObject> callback);
void getSelectedRE(String portalURL, AsyncCallback<VObject> callback);
void getDefaultCommunityURL(AsyncCallback<String> callback);

View File

@ -23,6 +23,7 @@ import org.gcube.portlets.user.gcubeloggedin.client.LoggedinService;
import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
import org.gcube.portlets.user.gcubeloggedin.shared.VObject.UserBelongingClient;
import org.gcube.portlets.user.gcubeloggedin.shared.VREClient;
import org.gcube.portlets.user.gcubewidgets.server.ScopeServiceImpl;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
@ -46,6 +47,7 @@ import com.liferay.portal.security.permission.PermissionChecker;
import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
import com.liferay.portal.security.permission.PermissionThreadLocal;
import com.liferay.portal.service.GroupLocalServiceUtil;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay;
@ -94,19 +96,33 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
* return the current selected VRE
*/
public VObject getSelectedRE() {
public VObject getSelectedRE(String portalURL) {
ASLSession aslSession = getASLSession();
String username = aslSession.getUsername();
if (! isWithinPortal()) {
String friendlyURL = ScopeServiceImpl.extractOrgFriendlyURL(portalURL);
if (friendlyURL == null) {//the URL is not a portal URL, we are in devmode.
return new VREClient("Test", "", "" +
"Fishery and Aquaculture Resources Management (FARM) Virtual Organisation</b> The FARM Virtual Organisation is the <b><i>dynamic group of individuals</i></b> and/or <b><i>institutions</i></b> defined around a set of <b><i>sharing rules</i></b> in which <b><i>resource providers</i></b> and <b><i>consumers</i></b> specify clearly and carefully just what is shared, who is allowed to share, and the conditions under which sharing occurs to serve the needs of the <b><i>Fisheries and Aquaculture Resources Management</i></b>. This VO is conceived to support various application scenarios arising in the FARM Community including the production of Fisheries and Aquaculture Country Profiles, the management of catch statistics including harmonisation, the dynamic generation of biodiversity maps and species distribution maps. This Virtual Organisation currently consists of:<ul> <li> approximately <b><i>13 gCube nodes</i></b>, i.e. machines dedicated to run the gCube system;</li> <li> approximately <b><i>89 running instances</i></b>, i.e. running gCube services supporting the operation of the infrastructure;</li> <li> approximately <b><i>25 collections</i></b>, i.e. set of D4Science Information Objects including Earth images, AquaMaps, Graphs on catch statistics;</li> <li> approximately <b><i>66 metadata collections</i></b>, i.e. set of Metadata Objects describing the Information Objects through various features and schemas;</li> <li> approximately <b><i>58 other resources</i></b> including transformation programs, index types, etc.</li></ul></div>" +
"", "", "", UserBelongingClient.BELONGING, false, true);
}
_log.trace("getting Selected Research Environment");
HttpSession session = this.getThreadLocalRequest().getSession();
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
Organization currOrg = (Organization) session.getAttribute("CURR_RE_NAME");
Organization currOrg = null;
try {
List<Group> groups = GroupLocalServiceUtil.getGroups(0, GroupLocalServiceUtil.getGroupsCount());
for (Group g : groups) {
if (g.isOrganization() || g.isCommunity())
if (g.getFriendlyURL().compareTo(friendlyURL) == 0) {
long organizationId = g.getClassPK();
currOrg = OrganizationLocalServiceUtil.getOrganization(organizationId);
String scopeToSet = ScopeServiceImpl.buildScope(g);
getASLSession().setScope(scopeToSet);
_log.info("GOT Selected Research Environment: " + scopeToSet);
}
}
} catch (Exception e) {
e.printStackTrace();
}
/**
* set the current ORG bean in session
@ -120,6 +136,7 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
String name = currOrg.getName();
long logoId = currOrg.getLogoId();
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
String logoURL = themeDisplay.getPathImage()+"/organization_logo?img_id="+ logoId +"&t" + ImageServletTokenUtil.getToken(logoId);
String desc = "";
//set the description for the vre

View File

@ -4,7 +4,7 @@
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<set-property name="user.agent" value="gecko1_8,safari" />
<!-- <set-property name="user.agent" value="gecko1_8,safari" /> -->
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />