Example usage for com.liferay.portal.kernel.util HttpUtil encodePath

List of usage examples for com.liferay.portal.kernel.util HttpUtil encodePath

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util HttpUtil encodePath.

Prototype

public static String encodePath(String path) 

Source Link

Usage

From source file:com.liferay.layout.taglib.servlet.taglib.LayoutsTreeTag.java

License:Open Source License

protected JSONArray getPortletURLsJSONArray(Map<String, PortletURL> portletURLs) {

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    if (MapUtil.isEmpty(portletURLs)) {
        return jsonArray;
    }/*  w w  w.  j  av  a  2 s .co m*/

    for (Map.Entry<String, PortletURL> entry : portletURLs.entrySet()) {
        JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

        jsonObject.put("name", entry.getKey());

        PortletURL portletURL = entry.getValue();

        portletURL.setParameter("selPlid", "{selPlid}");

        jsonObject.put("value",
                StringUtil.replace(portletURL.toString(), HttpUtil.encodePath("{selPlid}"), "{selPlid}"));

        jsonArray.put(jsonObject);
    }

    return jsonArray;
}