Example usage for com.liferay.portal.kernel.theme PortletDisplay getInstanceId

List of usage examples for com.liferay.portal.kernel.theme PortletDisplay getInstanceId

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.theme PortletDisplay getInstanceId.

Prototype

public String getInstanceId() 

Source Link

Usage

From source file:com.liferay.asset.publisher.web.util.AssetRSSUtil.java

License:Open Source License

protected static String getAssetPublisherURL(PortletRequest portletRequest) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Layout layout = themeDisplay.getLayout();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    StringBundler sb = new StringBundler(6);

    String layoutFriendlyURL = GetterUtil.getString(PortalUtil.getLayoutFriendlyURL(layout, themeDisplay));

    if (!layoutFriendlyURL.startsWith(Http.HTTP_WITH_SLASH)
            && !layoutFriendlyURL.startsWith(Http.HTTPS_WITH_SLASH)) {

        sb.append(themeDisplay.getPortalURL());
    }/*from  w  ww.  j  a v a 2 s .  c o m*/

    sb.append(layoutFriendlyURL);
    sb.append(Portal.FRIENDLY_URL_SEPARATOR);
    sb.append("asset_publisher/");
    sb.append(portletDisplay.getInstanceId());
    sb.append(StringPool.SLASH);

    return sb.toString();
}