Example usage for com.liferay.portal.kernel.util URLCodec encodeURL

List of usage examples for com.liferay.portal.kernel.util URLCodec encodeURL

Introduction

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

Prototype

public static String encodeURL(String rawURLString, boolean escapeSpaces) 

Source Link

Usage

From source file:com.liferay.dynamic.data.mapping.type.document.library.internal.DocumentLibraryDDMFormFieldTemplateContextContributor.java

License:Open Source License

public String getFileEntryURL(HttpServletRequest request, JSONObject valueJSONObject) {

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

    FileEntry fileEntry = getFileEntry(valueJSONObject);

    if (fileEntry == null) {
        return StringPool.BLANK;
    }/*from   w w w  . j a v a  2  s  . co  m*/

    StringBundler sb = new StringBundler(9);

    sb.append(themeDisplay.getPathContext());
    sb.append("/documents/");
    sb.append(fileEntry.getRepositoryId());
    sb.append(StringPool.SLASH);
    sb.append(fileEntry.getFolderId());
    sb.append(StringPool.SLASH);
    sb.append(URLCodec.encodeURL(html.unescape(fileEntry.getTitle()), true));
    sb.append(StringPool.SLASH);
    sb.append(fileEntry.getUuid());

    return html.escape(sb.toString());
}