revised groups redirect URL

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@128878 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-05-27 12:10:50 +00:00
parent 3595995206
commit 92c634518f
3 changed files with 7 additions and 27 deletions

View File

@ -4,6 +4,9 @@
<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="invites-common-library-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/invites-common-library/invites-common-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="join-vre"/>
</wb-module>

View File

@ -80,8 +80,8 @@ public class VreThumbnail extends Composite {
}
@Override
public void onSuccess(String currentGroupName) {
Location.assign("/group/" +currentGroupName +"/explore?"+JoinVRE.GET_OID_PARAMETER+"="+myVre.getId());
public void onSuccess(String siteLandingPagePath) {
Location.assign(siteLandingPagePath +"/explore?"+JoinVRE.GET_OID_PARAMETER+"="+myVre.getId());
}
});
}

View File

@ -9,6 +9,7 @@ import java.util.List;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.common.portal.GCubePortalConstants;
import org.gcube.common.portal.PortalContext;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
import org.gcube.portal.databook.server.DatabookStore;
@ -96,36 +97,12 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
@Override
public String joinVRE(Long vreID) {
try {
return getCurrGroupFromURL().getName();
return PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest());
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
/**
*
* @return the Liferay Group of the Site corresponding to the virtualhost being used to access the portal
* e.g. if i-marine.d4science.org it would return the Liferay Group i-marine, if services.d4science.org it would return the Liferay Group services
* it assums that you have a Site defined for each virtual host supported
* @throws Exception
*/
private Group getCurrGroupFromURL() throws Exception {
Group site = null;
String currentVirtualHost = this.getThreadLocalRequest().getServerName();
_log.debug("currentHost is " + currentVirtualHost);
List<VirtualHost> vHosts = VirtualHostLocalServiceUtil.getVirtualHosts(0, VirtualHostLocalServiceUtil.getVirtualHostsCount());
for (VirtualHost virtualHost : vHosts) {
_log.debug("Found " + virtualHost.getHostname());
if (virtualHost.getHostname().compareTo("localhost") != 0 &&
virtualHost.getLayoutSetId() != 0 &&
virtualHost.getHostname().compareTo(currentVirtualHost) == 0) {
long layoutSetId = virtualHost.getLayoutSetId();
site = LayoutSetLocalServiceUtil.getLayoutSet(layoutSetId).getGroup();
return site;
}
}
return null;
}
/**
*
* @param session the Asl Session