Forums de discussion
session attributes sharing between the portlet WAR to the portal.
Koen Cleynhens, modifié il y a 13 années.
session attributes sharing between the portlet WAR to the portal.
Junior Member Publications: 83 Date d'inscription: 23/02/10 Publications récentes
I hope someone can help me.
What do I need: I need the ability to modify (add) the USER_ID attribute in the portal session (Liferay is running in the ROOT web app of Tomcat) from within a portlet running in another webapp.
I was able to capture the USER_ID attribute in the portlet environment, but not to add this when he is not available, or modify this.
=> therefor is did next steps (maybe not all steps are needed to have this working):
1) in the web app portlet context file start tag put attribute : crossContext="true"
2) set attribute emptySessionPath="true" in server.xml (conf file for Tomcat) for connector settings
3) private-session-attributes ="true" setting in liferay-portlet.xml in the portlet web app
4) session.shared.attributes=org.apache.struts.action.LOCALE,COMPANY_,USER_,LIFERAY_SHARED_
But for point 4 I did not change the default setting, because USER_ is already inside this
But now I'm looking for a way to have access (an not only read access) to the attributes from portlet to portal...?
What do I need: I need the ability to modify (add) the USER_ID attribute in the portal session (Liferay is running in the ROOT web app of Tomcat) from within a portlet running in another webapp.
I was able to capture the USER_ID attribute in the portlet environment, but not to add this when he is not available, or modify this.
=> therefor is did next steps (maybe not all steps are needed to have this working):
1) in the web app portlet context file start tag put attribute : crossContext="true"
2) set attribute emptySessionPath="true" in server.xml (conf file for Tomcat) for connector settings
3) private-session-attributes ="true" setting in liferay-portlet.xml in the portlet web app
4) session.shared.attributes=org.apache.struts.action.LOCALE,COMPANY_,USER_,LIFERAY_SHARED_
But for point 4 I did not change the default setting, because USER_ is already inside this
But now I'm looking for a way to have access (an not only read access) to the attributes from portlet to portal...?
Manuel de la Peña, modifié il y a 13 années.
RE: session attributes sharing between the portlet WAR to the portal.
Regular Member Publications: 116 Date d'inscription: 04/12/08 Publications récentes
Hello Koen
Have you tried, in your portlet, to access request in that way?
It's necessary to access request-session in that way to share attributes to portal session (and viceversa)
Manuel.
Have you tried, in your portlet, to access request in that way?
portletRequest.getPortletSession().getAttribute("my-session-ticket",PortletSession.APPLICATION_SCOPE)
It's necessary to access request-session in that way to share attributes to portal session (and viceversa)
Manuel.
Koen Cleynhens, modifié il y a 13 années.
RE: session attributes sharing between the portlet WAR to the portal.
Junior Member Publications: 83 Date d'inscription: 23/02/10 Publications récentes
Hello Manuel,
Thanks for answer.
1) access is not a real problem (this is ok with that property session.shared.attributes in portal-ext.properties or portal.properties)
2) I try to setAttribute with the extra attribute PortletSession.APPLICATION_SCOPE
=> But it is not working, I do not see in my PortalImp.getUser(request) coming in the attribute USER_ID added by the portlet.
=> What I see in the portlet action is that the session has got the normal attributes and also a kind of sharedattributes. When I added the USER_ID, it is not in the sharedattributes, but in the normal attributes... Maybe that is the problem?
=> Do you (or anybody else) have another solution to try out? Or maybe someone knows something about request.getRemoteUser() => How can I set the RemoteUser object from within the portlet?
Thanks for answer.
1) access is not a real problem (this is ok with that property session.shared.attributes in portal-ext.properties or portal.properties)
2) I try to setAttribute with the extra attribute PortletSession.APPLICATION_SCOPE
=> But it is not working, I do not see in my PortalImp.getUser(request) coming in the attribute USER_ID added by the portlet.
=> What I see in the portlet action is that the session has got the normal attributes and also a kind of sharedattributes. When I added the USER_ID, it is not in the sharedattributes, but in the normal attributes... Maybe that is the problem?
=> Do you (or anybody else) have another solution to try out? Or maybe someone knows something about request.getRemoteUser() => How can I set the RemoteUser object from within the portlet?
Koen Cleynhens, modifié il y a 13 années.
RE: session attributes sharing between the portlet WAR to the portal.
Junior Member Publications: 83 Date d'inscription: 23/02/10 Publications récentes
Nobody else a solution?