Fórumok
PortletSession.APPLICATION_SCOPE is being shared with other Users
Jawwad Farooq, módosítva 11 év-val korábban
PortletSession.APPLICATION_SCOPE is being shared with other Users
Junior Member Bejegyzések: 35 Csatlakozás dátuma: 2012.06.21. Legújabb bejegyzések
I am setting an attribute in Session using the following code:
And getting this on JSP using
But the problem is, it is working fine for the first user how logged in to the application. All the subsequent user how logged in gets a readonly instance of first user session. They cant change the value of this attribute but gets the current value of this.
I am using JSF 1.2, with JBoss Portlet Bridge
Please help as it is too much weird to me...........
Object objSession = FacesContext.getCurrentInstance().getExternalContext().getSession(true);
try
{
if (objSession instanceof PortletSession)
{
PortletSession portalSession = (PortletSession)objSession;
portalSession.setAttribute("test", "Transactions Clicked", PortletSession.APPLICATION_SCOPE);
}
}
catch( Exception e )
{
e.printStackTrace();
}
And getting this on JSP using
<h:outputtext value="#{httpSessionScope['test']}" />
But the problem is, it is working fine for the first user how logged in to the application. All the subsequent user how logged in gets a readonly instance of first user session. They cant change the value of this attribute but gets the current value of this.
I am using JSF 1.2, with JBoss Portlet Bridge
Please help as it is too much weird to me...........
Neil Griffin, módosítva 11 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
PortletSession.APPLICATION_SCOPE is designed for sharing data between different portlets that reside in the same WAR. It is basically a layer of abstraction on top of HttpSession, so the data for user1 should not be visible to user2, since each user has the same session.
Do you want the users to be able to share data? If so, then you would need to keep that in application scope, and be careful to make it thread-safe.
Do you want the users to be able to share data? If so, then you would need to keep that in application scope, and be careful to make it thread-safe.
Jawwad Farooq, módosítva 11 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Junior Member Bejegyzések: 35 Csatlakozás dátuma: 2012.06.21. Legújabb bejegyzésekNeil Griffin:
PortletSession.APPLICATION_SCOPE is designed for sharing data between different portlets that reside in the same WAR. It is basically a layer of abstraction on top of HttpSession, so the data for user1 should not be visible to user2, since each user has the same session.
Do you want the users to be able to share data? If so, then you would need to keep that in application scope, and be careful to make it thread-safe.
Thanks for commenting....
I want to share between different portlets of same and different WAR but the data should be user specific. This means each user of the application maintains his own session that will be available among different portlets of different WARs.
Neil Griffin, módosítva 11 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzésekAll the subsequent user how logged in gets a readonly instance of first user session. They cant change the value of this attribute but gets the current value of this
Just to make sure that I understand, you don't want a readonly instance of the first user session right? Instead, you would like each user to have his own session, right?
Jawwad Farooq, módosítva 11 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Junior Member Bejegyzések: 35 Csatlakozás dátuma: 2012.06.21. Legújabb bejegyzésekNeil Griffin:
All the subsequent user how logged in gets a readonly instance of first user session. They cant change the value of this attribute but gets the current value of this
Just to make sure that I understand, you don't want a readonly instance of the first user session right? Instead, you would like each user to have his own session, right?
Right Neil, you fully grasp what I want to do ..
Thanks...
Neil Griffin, módosítva 11 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
It looks like you are doing everything correctly. The "#{httpSessionScope['test']}" EL-expression should be working. Also the session scoping should be working on a per-user basis like you want. Do you have the opportunity to upgrade to JSF 2 and Liferay Faces Bridge? It should be working there.
One thing you can try for now, is to create a managed-bean that does something like this:
And then access it via EL like this:
One thing you can try for now, is to create a managed-bean that does something like this:
public class MyManagedBean {
public String getTest() {
FacesContext facesContext = FacesContext.getCurrentInstance();
PortletSession portletSession = facesContext.getExternalContext().getSession(true);
return portletSession.getAttribute("test", PortletSession.APPLICATION_SCOPE);
}
}
And then access it via EL like this:
<h:outputtext value="#{myManagedBean.test}"" />
Atif Hussain, módosítva 10 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Junior Member Bejegyzések: 47 Csatlakozás dátuma: 2012.04.03. Legújabb bejegyzések
Hi Neil,
this just issue just produced a moment ago in our system, the system is in production, we are unable to solve it, even no work around is possible.
session.application_scope is sharing data of one user with other users.
this just issue just produced a moment ago in our system, the system is in production, we are unable to solve it, even no work around is possible.
session.application_scope is sharing data of one user with other users.
Neil Griffin, módosítva 10 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
What version of Liferay Portal are you using in production? Also what application server and version are you using?
Since PortletSession is built on top of the HttpSession, it should not be shared with other users.
Since PortletSession is built on top of the HttpSession, it should not be shared with other users.
Atif Hussain, módosítva 10 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Junior Member Bejegyzések: 47 Csatlakozás dátuma: 2012.04.03. Legújabb bejegyzések
liferay-portal-6.1.1-ce-ga2 with bundled tomcat-7.0.27. The portlets where the problem is coming are also communicate with each other through IPC. The managed bean is in session scope for both of these portlets. (I load data on preRenderView).
Atif Hussain, módosítva 10 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Junior Member Bejegyzések: 47 Csatlakozás dátuma: 2012.04.03. Legújabb bejegyzések
The worst part is: I am unable to produce the issue on local machine.
Juan Gonzalez, módosítva 10 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Liferay Legend Bejegyzések: 3089 Csatlakozás dátuma: 2008.10.28. Legújabb bejegyzésekAtif Hussain:
Hi Neil,
this just issue just produced a moment ago in our system, the system is in production, we are unable to solve it, even no work around is possible.
session.application_scope is sharing data of one user with other users.
So you said it was working before? Do you use any kind of cache/web server for pages between Liferay and clients?
Atif Hussain, módosítva 10 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Junior Member Bejegyzések: 47 Csatlakozás dátuma: 2012.04.03. Legújabb bejegyzésekJuan Gonzalez:
Atif Hussain:Hi Neil,
this just issue just produced a moment ago in our system, the system is in production, we are unable to solve it, even no work around is possible.
session.application_scope is sharing data of one user with other users.
So you said it was working before? Do you use any kind of cache/web server for pages between Liferay and clients?
No, but system is clustered, consists of two VMs (one is off at the moment). So I guess session replication is causing problems.
Juan Gonzalez, módosítva 10 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Liferay Legend Bejegyzések: 3089 Csatlakozás dátuma: 2008.10.28. Legújabb bejegyzések
Hi Atif,
I would then check if it's working with Liferay Faces (which is the best environment we can help you out). You can use Liferay Faces 2.1.x version to fit your Liferay Environment.
Anyway, it would be great if you can provide us a portlet sample to reproduce the issue (better with sources so we can modify).
I would then check if it's working with Liferay Faces (which is the best environment we can help you out). You can use Liferay Faces 2.1.x version to fit your Liferay Environment.
Anyway, it would be great if you can provide us a portlet sample to reproduce the issue (better with sources so we can modify).
Atif Hussain, módosítva 10 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Junior Member Bejegyzések: 47 Csatlakozás dátuma: 2012.04.03. Legújabb bejegyzések
I am still facing the issue, when ipc is used...
Neil Griffin, módosítva 10 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
Hi Atif,
If you attach a test portlet and a set of steps that we can use to reproduce the problem in a development environment, then we'd be happy to try and help.
Kind Regards,
Neil
If you attach a test portlet and a set of steps that we can use to reproduce the problem in a development environment, then we'd be happy to try and help.
Kind Regards,
Neil
Atif Hussain, módosítva 9 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Junior Member Bejegyzések: 47 Csatlakozás dátuma: 2012.04.03. Legújabb bejegyzések
Well Neil, We have solved problem using PortletSession for IPC.
Neil Griffin, módosítva 9 év-val korábban
RE: PortletSession.APPLICATION_SCOPE is being shared with other Users
Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
I'm glad to hear that good news. If you have time, I would be interested to know more details about how you solved the problem.
Kyle Joseph Stiemann, módosítva 9 év-val korábban
Thread Split
Liferay Master Bejegyzések: 760 Csatlakozás dátuma: 2013.01.14. Legújabb bejegyzések
Please start a new thread when asking a new question.
The new thread can be found at https://www.liferay.com/community/forums/-/message_boards/view_message/41970018.
- Kyle
The new thread can be found at https://www.liferay.com/community/forums/-/message_boards/view_message/41970018.
- Kyle