Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
sanga reddy
Sharing the session object from one .war to other .war
June 17, 2014 3:52 AM
Answer

sanga reddy

Rank: New Member

Posts: 5

Join Date: April 27, 2009

Recent Posts

Hi,

I have two .wars, In one .WAR project ( in any java file) I am setting the values in one Object in session object. (i.e String str= (String)session.setAttribute("sessionValue",sessionValue,PortletSession.APPLICATION_SCOPE);

I want to access that object in the .vm (velocity template), The .VM file is exist in other .WAR .


Please help me how to I get the session values in .vm file.


Thanks in advance

sangam
Hitesh Methani
RE: Sharing the session object from one .war to other .war
June 17, 2014 6:55 AM
Answer

Hitesh Methani

Rank: Regular Member

Posts: 169

Join Date: June 24, 2010

Recent Posts

Hello Sanga,

If your first war file from which you want to set session variables is a portlet, you can set private-session-attributes as 'false' in liferay-portlet.xml which will allow themes to access session variables set in that portlet.

<private-session-attributes>false</private-session-attributes>

You can add above line in your liferay-portlet.xml.

HTH.

Thanks,
Hitesh Methani.
Suresh Gurusamy
RE: Sharing the session object from one .war to other .war
August 27, 2014 12:24 PM
Answer

Suresh Gurusamy

Rank: New Member

Posts: 2

Join Date: August 27, 2014

Recent Posts

Hi,
If you not abt able to get session variable from your theme war please follow the below steps

+ add the prefix LIFERAY_SHARED_ in the session variable and try to access in theme war. and if you are sharing the string value across wars through the liferay session then you can easily share, but if you are sharing some obj then you have to place the session object into the shared library in the server.(convert the session classes into jar and place it in server shared library path)

(String)session.setAttribute("LIFERAY_SHARED_sessionValue",sessionValue,PortletSession.APPLICATION_SCOPE);