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(String lifecycle);

Source Link

Usage

From source file:com.liferay.portlet.layoutconfiguration.util.xml.ActionURLLogic.java

License:Open Source License

@Override
public String processXML(String xml) throws Exception {
    Document doc = SAXReaderUtil.read(xml);

    Element root = doc.getRootElement();

    LiferayPortletResponse liferayPortletResponse = PortalUtil.getLiferayPortletResponse(_renderResponseImpl);
    LiferayPortletURL liferayPortletURL = liferayPortletResponse.createLiferayPortletURL(getLifecycle());

    String portletId = root.attributeValue("portlet-name");

    if (portletId != null) {
        portletId = PortalUtil.getJsSafePortletId(portletId);

        liferayPortletURL.setPortletId(portletId);
    }/*from   w  w  w.  j  av  a  2 s  . c o m*/

    for (int i = 1;; i++) {
        String paramName = root.attributeValue("param-name-" + i);
        String paramValue = root.attributeValue("param-value-" + i);

        if ((paramName == null) || (paramValue == null)) {
            break;
        }

        liferayPortletURL.setParameter(paramName, paramValue);
    }

    return liferayPortletURL.toString();
}