掲示板

portletRequest.getPortletSession() returns null

9年前 に Rafael Rodrigues によって更新されました。

portletRequest.getPortletSession() returns null

New Member 投稿: 3 参加年月日: 14/08/21 最新の投稿
In my project, I want to use Liferay Login to autenticate the users, for that, I developed a hook that adds functionalities to the liferay login, the rest of the project is adapted from a one previously developed for IBM websphere and its located in another war file.

I guess there is no problem, but this project requires some login information saved in PortletSession, like the userName, sessionUuid...

I tried this:

	PortletRequest portletRequest = (PortletRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);
	PortletSession session = portletRequest.getPortletSession();
	session.setAttribute("TEST_PORTLET_SESSION", "GOT_THERE", PortletSession.APPLICATION_SCOPE);
	session.setAttribute("webtoolPortlets."+"sessionUuid", session.getId(), PortletSession.APPLICATION_SCOPE);


but it returns null for the PortletSession.

So my question is: How do I transfer this information from the plugin to the application PortletSession?

Thanks in advance!
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: portletRequest.getPortletSession() returns null

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
First, this thread has nothing to do with your request, you should have started a new thread...

That said, application scope only works between portlets in the same war file. if you are in different wars, then you need a completely different mechanism. I'd suggest cookies for client side or database for server side.
thumbnail
9年前 に Kyle Joseph Stiemann によって更新されました。

Moved.

Liferay Master 投稿: 760 参加年月日: 13/01/14 最新の投稿
Moved to Home » Liferay Portal » English » 3. Development
thumbnail
9年前 に Subhasis Roy によって更新されました。

RE: portletRequest.getPortletSession() returns null

Expert 投稿: 275 参加年月日: 12/01/20 最新の投稿
you can try the following -

PortletSession portletSession = renderRequest.getPortletSession();  
portletSession.getAttribute("param1" ,PortletSession.APPLICATION_SCOPE);
thumbnail
9年前 に Andew Jardine によって更新されました。

RE: portletRequest.getPortletSession() returns null

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
I think David already explained that APPLICATION_SCOPE only works when plugins are in the SAME war file. The original post states that he has more than one war file, so APPLICATION_SCOPE won't help here.
thumbnail
9年前 に Subhasis Roy によって更新されました。

RE: portletRequest.getPortletSession() returns null

Expert 投稿: 275 参加年月日: 12/01/20 最新の投稿
i think, you can try for IPC mechanism