How to get context path without using themedisplay object in liferay

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

I am using liferay 6.1

+4
source share
2 answers

Unfortunately, there is no (simple) way to do this.

The reason is that the object is ThemeDisplayattached to the current user and the current page. In the context of the scheduler (i.e., an automatically triggered event created by the system itself), there is no current registered user (normal, you can use the default user, but ...), and there is no page displayed.

. , . , PortalUtil.getPortalURL() .

, ThemeDisplay.

+2

    Company company = CompanyLocalServiceUtil.getCompanies().get(0);
    String portalURL = PortalUtil.getPortalURL(company.getVirtualHostname(),PortalUtil.getPortalPort(), false);
    String pathContext = PortalUtil.getPathContext();
+2

All Articles