Example usage for com.liferay.portal.kernel.portlet LiferayPortletResponse createLiferayPortletURL

List of usage examples for com.liferay.portal.kernel.portlet LiferayPortletResponse createLiferayPortletURL

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.portlet LiferayPortletResponse createLiferayPortletURL.

Prototype

public LiferayPortletURL createLiferayPortletURL(long plid, String portletName, String lifecycle,
            MimeResponse.Copy copy);

Source Link

Usage

From source file:com.liferay.content.targeting.util.ContentTargetingContextUtil.java

License:Open Source License

public static String getControlPanelPortletURL(Map<String, Object> context, String portletId,
        Map<String, String> params) {

    LiferayPortletResponse liferayPortletResponse = (LiferayPortletResponse) context.get("renderResponse");

    Company company = (Company) context.get("company");

    try {//from   w  ww  . ja  v a 2s .  c  om
        PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(
                PortalUtil.getControlPanelPlid(company.getCompanyId()), portletId, PortletRequest.RENDER_PHASE,
                false);

        if ((params != null) && !params.isEmpty()) {
            for (String param : params.keySet()) {
                portletURL.setParameter(param, params.get(param));
            }
        }

        return HttpUtil.removeParameter(portletURL.toString(), "controlPanelCategory");
    } catch (Exception e) {
        _log.error(e);
    }

    return null;
}