PrincipalThreadLocal.getUserId() is 0 for Icefaces (1.8.2) portlets - liferay

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.

Related

Liferay : How to see which portlets are composing a page?

I'm new to liferay.
I imported a big lar into my liferay instance but, for the moment, have none of the required portlets : there are a lot of portlets in the project I'm joining.
Currently, I have the site structure, but the pages display the message that the portlet is not here (logical).
For comprehension purposes, I wanted to build my portlets one after the other, on the need, to see them appear by the grace of liferay ;-)
But for that I wanted to know which portlet is missing.
This thread : How can i find - which portlets are deployed on which pages in Liferay 6.1? explain how to achieve this through the DB.
Is there really no built-in solution to do it through the liferay interface? Have we really to hack in the DB to get the info or install plugin?
Thanks!
In your browser console, Liferay.Portlet.list contains all portlets in the page.
This value is generated by themeDisplay.getLayoutTypePortlet().getAllPortlets() on the server.
As an alternative you can also look at the HTML code of the page and look for elements with the class portlet-boundary. For example this belongs to an instance of the Journal Content Portlet (Portlet name 56):
<div class="portlet-boundary portlet-boundary_56_ portlet-static portlet-static-end portlet-borderless portlet-journal-content full-screen" id="p_p_id_56_INSTANCE_WdRdMGe86kDa_">

Portlet content is not shown in Liferay

I've recently started working with portlets, and trying to have experience with several portal engines. I have a basic hello world portlet (extending GenericPortlet and basically doing the same as in all tutorials) that works perfectly with Pluto 2.
I deployed the same portlet to Liferay 6.0, and added it to a page in the portal. Strangely, the portlet frame appears without any content. According to the logs, the portlet init() is called, but doView() is not, thus there's no portlet content in the resulted HTML page.
My question is: should the same portlet work out of the box with Liferay, too? If not, what non-standard descriptors are mandatory for deploying a portlet to Liferay? If yes, what may be the problem? I've seen portlet content height issues mentioned in some forums, but this may not be the problem: the content is not hidden, it's not generated at all.
While checking the relevant file contents to paste here as asked, I realized that my web.xml is empty (as it should be according to Liferay tutorials), but a maven plugin generates pluto-specific invoker definitions into it as defined in my pom.xml. As a result, the generated pluto-specific PlutoInvoker mappings screwed it all up. So it was solved easily, thanks for reading the question though.

Different Message Board Portlet on different page in Liferay 5.2.3

Is it possible to implement different Message board portlet on different page in Liferay 5.2.3. But now if I am adding Message Board on two pages same posts are coming. I want these to be totally separate from each other. Can anyone help me in this regard.
I do not recall having scope content in 5.2.3 Liferay 6 does support page scoped content, so you can have different MB or blogs or wiki portlet on different pages of same community/org.
To check if scoping is supported in Liferay 5.2.3, Add MessageBoard portlet on a page. Click on Configuration(Its under look and feel icon of the portlet) and see if you have Scope tab. If you have Scope tab then, Liferay 5.2.3 supports scoping. Click on Scope tab. Select the current layout scope and click on save.
If you dont see Scope tab in Configuration option of the portlet, then it can confirmed that Liferay 5.2.3 does not support the feature you are looking for and you have to upgrade to Liferay 6

Liferay : custom Web content Display List Portlet

I'm beginner in Liferay, and I need to customize the portlet webcontent display list.
I added a portlet in my page Home, and I managed to see the recent news that I created.
The news is displayed in a table (title, author and date display).
I want to display the news like this:
- The date of the news (above the title of the news)
- The title of the news (which is a link to the news)
I tried to create a structure, but I do not see commits its work?
Thank you to enlighten me?
PS: sorry for this English !!
Liferay is available in source - did you look at the implementation of the webcontent list portlet? You can either create a jsp hook for that portlet or just reimplement a similar one based on what you find in there...
As you say you'd like to customize Webcontent display list I assume you don't want its default behaviour. Once you know what to change in this portlet, read about jsp hooks, create a hook with the jsp changes you'd like (if it's limited to jsp changes) and deploy it.
Liferay's development documentation should have the information that you need, otherwise continue in the wiki on liferay.com
Edit: Also, you might want to look at AssetPublisher - maybe this provides a few more options for formatting your output.
Generally Liferay web content in journalarticle table. I have referred Liferay 6.0 Version.
Now, for showing liferay custom portlet view, you should use Liferay Portlet Creation and Liferay Service Builder.
Here are two useful article on those -
1> Liferay MVC Portlet
2> Liferay Service Builder
Now make the service for journalarticle table and use those in your portlet.
Some useful fields of journalarticle table for your reference are - title, createDate etc.

Development questions related to Liferay 6

I am using Liferay version 6.06. I have developed a Login Portlet using Liferay plugins SDK under which the View JSP consists of a login screen. Upon submitting credentials from this view JSP it will be received by the processAction Method of my Custom Portlet class. All this works good.
I have two questions:
Currently the Login Portlet is being part of Sample Category under Liferay screen (I want to have my own screen, where initially upon entering http://localhost:8080/mycontext, I want to show that Login screen).
And once the credentials are received inside the processAction method of my Custom Portlet class, I want to display my own two portlets.
Could anybody tell me how to achieve this?
Beside you don't need a customized login for your Usecase, in case you still need to customize the login process you should:
build a hook which is a kind of plugin able to interact with Liferay's core functionalities.
In case you don't know take a look [here] http://www.liferay.com/it/documentation/liferay-portal/6.0/development/-/ai/hooks
or just use the property login.events.post=my.custom.PortletAction
and put your business logic after successfull user login

Resources