Difference between revisions of "ASL Session removal instructions for portlets before gCube 4.2.0"

From Gcube Wiki
Jump to: navigation, search
(Step 3: Remove ScopeHelper setContext call in your portlet class doView)
(Step 3: Remove ScopeHelper setContext call in your portlet class doView)
Line 65: Line 65:
 
</source>
 
</source>
  
The doView method should look like the following:
+
The new doView method should look like the following (note that ScopeHelper.setContext(request) is removed) :
  
 
<source lang="java">
 
<source lang="java">

Revision as of 17:00, 15 November 2016

Introduction

This guide contains instructions on how to replace ASL Core component an explain how to btain the same contextual information (current user and scope) you used to retrieve from ASL Core component in an better and reliable way by exploiting the gCube Portal_Context component.

This guide assumes your portlet was developed prior to gCube 4.2.0 and already uses ASL Core component. If this is not the case, go straight to Portal_Context to understand how to get contextual information in your web application. It also assumes that you use the maven-portal-bom artifact for dependency management.

Step 1: dependencies removal

Remove the following dependencies from your pom.xml:

  • ASL Core
<dependency>
        <groupId>org.gcube.applicationsupportlayer</groupId>
	<artifactId>aslcore</artifactId>
       <scope>provided</scope>
</dependency>
  • Custom Portal Handler
<dependency>
	<groupId>org.gcube.portal</groupId>
	<artifactId>custom-portal-handler</artifactId>
	<scope>provided</scope>
</dependency>

Step 2: Portal Manager & User Management Core dependencies check

Add the following dependencies to your pom.xml (if not present already):

  • Portal Manager
<dependency>
	<groupId>org.gcube.common.portal</groupId>
	<artifactId>portal-manager</artifactId>
	<scope>provided</scope>
</dependency>
  • User Management Core
<dependency>
	<groupId>org.gcube.dvos</groupId>
	<artifactId>usermanagement-core</artifactId>
	<scope>provided</scope>
</dependency>

Step 3: Remove ScopeHelper setContext call in your portlet class doView

ScopeHelper.setContext is no longer needed, if you removed the custom-portal-handler dependency correctly your portlet class should not compile anymore. Remove the following line:

public void doView(RenderRequest request, RenderResponse response)    throws PortletException, IOException {
    ScopeHelper.setContext(request); // <-- '''REMOVE THIS LINE'''
    PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(....);
    dispatcher.include(request, response);
}

The new doView method should look like the following (note that ScopeHelper.setContext(request) is removed) :

public void doView(RenderRequest request, RenderResponse response)    throws PortletException, IOException {
    PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(....);
    dispatcher.include(request, response);
}

Related links and references