0

I am basically implementing logger on the generic actions like saving portlet's preferences in store method of PortletPreferencesImpl. Here I am calling PrincipalThreadLocal.getUserId() to get user information.

Everything is fine for the Liferay OTB's portlets and for Primefaces 5.2 portlets but when I am saving preferences of Icefaces (1.8.2) portlet, I am always getting 0 from PrincipalThreadLocal.getUserId().

Why is this strange behavior? Please share your valuable feedback.

Parkash Kumar
  • 4,710
  • 3
  • 23
  • 39
  • Cross posted: [***Liferay Forum***](https://web.liferay.com/community/forums/-/message_boards/message/87782723) – Parkash Kumar Mar 30 '17 at 11:23
  • Have you checked, if IceFaces is using a thread different from the portlet thread (`new Exception().printStackTrace()` right before the call to `getUserId()` should show you the stacktrace of the current thread)? – Tobias Liefke Mar 30 '17 at 13:20
  • I have already checked, there is nothing special in the stack-trace. After invoking my preferences class action, store of PortletPreferencesImpl is called. – Parkash Kumar Mar 30 '17 at 13:35
  • The only difference that I have figured out is that the `service` method of `MainServlet` is being invoked for other portlet types except Icefaces. And to add more interest this servlet is setting the `userId` in `name` property of `PrincipalThreadLocal`. – Parkash Kumar Mar 30 '17 at 13:40
  • One can find further information regarding this post on [***Liferay Forum***](https://web.liferay.com/community/forums/-/message_boards/message/87816062) thread. – Parkash Kumar Mar 31 '17 at 07:15

0 Answers0