added extractOrgFriendlyURL method

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gcube-widgets@126756 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-04-04 16:57:04 +00:00
parent 9c246a1168
commit e9fbcf32bd
1 changed files with 15 additions and 0 deletions

View File

@ -10,4 +10,19 @@ public class ClientScopeHelper {
return GWT.create(ScopeService.class);
//Window.Location.getHref();
}
public static String extractOrgFriendlyURL(String portalURL) {
String groupRegEx = "/group/";
if (portalURL.contains(groupRegEx)) {
String[] splits = portalURL.split(groupRegEx);
String friendlyURL = splits[1];
if (friendlyURL.contains("/")) {
friendlyURL = friendlyURL.split("/")[0];
} else {
friendlyURL = friendlyURL.split("\\?")[0].split("\\#")[0];
}
return "/"+friendlyURL;
}
return null;
}
}