Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Alexandra Mereuta
ThemeDisplay in hook action class is null
October 11, 2010 8:36 AM
Answer

Alexandra Mereuta

Rank: New Member

Posts: 3

Join Date: July 8, 2010

Recent Posts

Hi,
I'm using Liferay 6.0.5 and I have a hook that overrides the login.events.post portal property. In my class that extends the Action class I want to get the themeDisplay and I do this in the run(HttpServletRequest request, HttpServletResponse response) method:
1ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);


The problem is ThemeDisplay attribute is not among the attributes of the request so the themeDisplay object is null. So what am I doing wrong and how can I get the themeDisplay?

Thanks
Armaz Mellati
RE: ThemeDisplay in hook action class is null
January 8, 2011 1:25 PM
Answer

Armaz Mellati

Rank: Junior Member

Posts: 66

Join Date: October 30, 2009

Recent Posts

I have the same issue. I am trying to change the DefaultLandingPageAction. However I can get the User object, but I need the themeDisplay too and I have no idea how to get it.

Hope someone has any idea on this.

Regards,
Armaz
Kim Anna Kunc
RE: ThemeDisplay in hook action class is null
February 9, 2011 2:55 AM
Answer

Kim Anna Kunc

Rank: Junior Member

Posts: 30

Join Date: February 18, 2009

Recent Posts

Armaz Mellati:
I have the same issue. I am trying to change the DefaultLandingPageAction. However I can get the User object, but I need the themeDisplay too and I have no idea how to get it.

Hope someone has any idea on this.

Regards,
Armaz



Hi Amaz,
I'm not sure if ThemeDisplay is set in the HTTPServletRequest.
What values in ThemeDisplay do you need ?
Have you tried reading it from the session ?

I'm using the "last path" param for my forwarding logic in DefaultLandingPageAction...

HttpSession session = request.getSession();
LastPath currentLastPath = (LastPath) session.getAttribute(WebKeys.LAST_PATH);
Minhchau Dang
RE: ThemeDisplay in hook action class is null
February 9, 2011 9:15 PM
Answer

Minhchau Dang

LIFERAY STAFF

Rank: Expert

Posts: 349

Join Date: October 22, 2007

Recent Posts

Alexandra Mereuta:
The problem is ThemeDisplay attribute is not among the attributes of the request so the themeDisplay object is null. So what am I doing wrong and how can I get the themeDisplay?

The ThemeDisplay object is initialized during service.pre which runs after login.post. Therefore, if you need a fully-populated ThemeDisplay object before that, you won't find it in the servlet request.

If you really need it, you'll need to do something funny like set request attributes and do something after the default Liferay service.pre events are processed (like in a ServicePostAction). If you just need a generic one to pass around to different function calls and the values don't matter, you can just call ThemeDisplayFactory.create().
Jitendra Rajput
RE: ThemeDisplay in hook action class is null
February 22, 2011 4:04 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 709

Join Date: January 7, 2011

Recent Posts

I think you can not get ThemeDisplay at the time of login.even.post.
if you wish you can get important parameter like "COMPANY_ID" ,"USER_ID" ,"CURRENT_URL"
by using httprequest.getAttribute("USER_ID")..
For the list of parameter available in http request use method httprequest.getAttributeNames() it will list parameter available in http request
Guillaume Lhermitte
RE: ThemeDisplay in hook action class is null
February 21, 2012 2:45 AM
Answer

Guillaume Lhermitte

Rank: New Member

Posts: 13

Join Date: November 2, 2010

Recent Posts

Simple, Usefull, Efficient, before I red your post I was looking far from the most obvious and elegant way to get those precious informations.

Thank you !
Harish Bhutada
RE: ThemeDisplay in hook action class is null
May 8, 2013 11:43 PM
Answer

Harish Bhutada

Rank: New Member

Posts: 1

Join Date: May 8, 2013

Recent Posts

Hiii Alexandra
I also face the same problem
you just go in portal.properties file and write
servlet.service.events.post=your action class
this may solve your problem