简体   繁体   中英

How to get Liferay site name from inside Portlet class?

I can get the current Liferay site name from JSP:

<%= themeDisplay.getLayout().getGroup().getName() %>

It gives for instance "Guest".

QUESTION : How to get the same from the Java Portlet class ?

The closest I have found are the PortalUtil.getLayoutURL methods but I don't want an URL as the site name from the URL is all lowercase and potentially different from the real site name.

Or simply:

ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest
            .getAttribute(WebKeys.THEME_DISPLAY);
themeDisplay.getScopeGroup().getName();
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest
            .getAttribute(WebKeys.THEME_DISPLAY);    
GroupLocalServiceUtil.getGroup(themeDisplay.getScopeGroupId()).getName();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM