Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get path Context without using themedisplay object in liferay

Can anyone help me how to get path context in liferay without themedisplay object (means in scheduler )

I am using liferay 6.1

like image 648
sonal Avatar asked Oct 01 '22 19:10

sonal


1 Answers

Unfortunately, there's no (simple) way of doing that.

The reason is that the ThemeDisplay object is tied to the current user and the current page. In the context of a scheduler (i.e., an automatically triggered event made by the system itself), there's no current logged in user (ok, you could use the default user, but...), and there's no displayed page.

What you can do however is to make the required data available from somewhere else. You can store it in a custom property, read it from the DB or get it through services and so on. The PortalUtil.getPortalURL() function for instance may be your friend.

Otherwise, you need the request object to get the ThemeDisplay.

like image 114
rlegendi Avatar answered Oct 05 '22 11:10

rlegendi