Difference between revisions of "Portal Context"
From Gcube Wiki
(→Example) |
|||
Line 1: | Line 1: | ||
+ | __FORCETOC__ | ||
=== Introduction === | === Introduction === | ||
The gCube Portal Manager is a component all portlets need to use to get the context where they are running into. Moreover, passing an HttpServletRequest object to its methods, you can also: | The gCube Portal Manager is a component all portlets need to use to get the context where they are running into. Moreover, passing an HttpServletRequest object to its methods, you can also: |
Revision as of 11:53, 3 May 2016
Contents
Introduction
The gCube Portal Manager is a component all portlets need to use to get the context where they are running into. Moreover, passing an HttpServletRequest object to its methods, you can also:
- retrieve the list of Virtual Organizations available on a given portal;
- retrieve the configured senders of emails sent by the portal;
- retrieve the gateway of the portal.
Maven Dependency
In order to use it in your project, add the following dependency to the project's pom.xml file
<dependency> <groupId>org.gcube.common.portal</groupId> <artifactId>portal-manager</artifactId> <scope>provided</scope> </dependency>
Example
A new instance of the manager can be retrieved by invoking
PortalContext instance = PortalContext.getConfiguration();
A part this information, the new version allows to retrieve:
- The name of the gateway and its URL
// get the gateway name given the HttpServletRequest String gatewayName = instance.getGatewayName(request); // get the gateway url given the HttpServletRequest String gatewayUrl = instance.getGatewayUrl(request);
- mail sender for the current site
// get the current site email's sender (used when notifications are sent, for example), given the HttpServletRequest String sender = instance.getSenderEmail(request);
- the name of the current infrastructure in which the client is running
// get the current infrastructure name String infrastructureName = instance.getInfrastructureName();
- retrieve the list of VOs
// get the VOs List<String> listVo = instance.getVOs();