-
Type:
Bug
-
Status: Closed
-
Resolution: Won't Fix
-
Affects Version/s: 6.1.1 CE GA2
-
Fix Version/s: 6.1.1 CE GA2
-
Component/s: Dev Tools, Dev Tools > Plugins SDK
-
Labels:
-
Environment:Liferay Version : 6.1.1 CE GA2
JDK : 1.6.0_33
Application Server : tomcat-6.0.35
OS : Windows 7, Ret Hat 6.2
-
Liferay Contributor's Agreement:Accept
-
Git Pull Request:
Tried the session sharing between the life-ray portlet and servlet residing in the same war using the following configuration. And it worked in the liferay version 6.0.6 CE and older version but it is not working in the liferay version 6.1.1 CE GA2
Enable the Private portlet session by Adding the following tag in the liferay-portlet.xml
<private-session-attributes>true</private-session-attributes>
To share the session between portal and portlet. Define the shared session attribute in portal-ext.properties file by configuring the following property in the property file
session.shared.attributes= LIFERAY_SHARED_ , APP_SHARED_
In the portlet action set the variable to portlet session. to share that variable with the servlet.
public class XYZAction extends GenericPortlet {
....................
public void doView(RenderRequest request, RenderResponse response) throws PortletException
{ // Get portlet session PortletSession prtSession = request.getPortletSession(); // Read value of shared variable String testvar = (String) prtSession.getAttribute("APP_SHARED_testvar", PortletSession.APPLICATION_SCOPE); // set variable to portlet session to share with servlet prtSession.setAttribute( "APP_SHARED_testvar", testvar , PortletSession.APPLICATION_SCOPE); } .................
}
Read the variable in the servlet. And it is not available in servlet.
public class XYZServlet extends HttpServlet {
.................
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException
.................
}