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)
Line 55: Line 55:
 
== Step 3: Remove ScopeHelper setContext call in your portlet class doView ==
 
== Step 3: Remove ScopeHelper setContext call in your portlet class doView ==
  
If you removed the custom-portal-handler dependency correctly your portlet class should not compile anymore. Remove the following line:
+
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:
  
 
<source lang="java">
 
<source lang="java">
Line 63: Line 63:
 
     dispatcher.include(request, response);
 
     dispatcher.include(request, response);
 
}
 
}
</source>  
+
</source>
 +
 
 +
The doView method should look like the following:
 +
 
 +
<source lang="java">
 +
public void doView(RenderRequest request, RenderResponse response)    throws PortletException, IOException {
 +
    PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(....);
 +
    dispatcher.include(request, response);
 +
}
 +
</source>
  
 
== Related links and references ==
 
== Related links and references ==

Revision as of 15:59, 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 doView method should look like the following:

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

Related links and references