Skip to main content

Posts

Showing posts from May, 2010

Liferay DWR Integration issues and solution

DWR classes doesn't have access to Liferay request and session attributes. i.e. inside dwr classes this won't work PortalUtil.getUser(req) --- return null Also sharing themeDisplay object using post login hook won't work.. since postlogin-hook's session data is not shared with other portlet applications One way to access themeDisplay object inside DWR classes is do this.. Add these lines to doView().. ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); request.getPortletSession().setAttribute("themeDisplay", themeDisplay, PortletSession.APPLICATION_SCOPE); and inside DWR class access like this public void test(HttpSession session) { ThemeDisplay themeDisplay = (ThemeDisplay) session.getAttribute("themeDisplay"); logger.trace(" community name :" + themeDisplay.getScopeGroupName()); }