Skip to content

Instantly share code, notes, and snippets.

@evaldeslacasa
Created February 21, 2020 22:43
Show Gist options
  • Save evaldeslacasa/14e5eba68a1c0d56a19db30813872d6f to your computer and use it in GitHub Desktop.
Save evaldeslacasa/14e5eba68a1c0d56a19db30813872d6f to your computer and use it in GitHub Desktop.
Method to add parameters in URLs for Liferay
protected static String addParameterWithPortletNamespace(
String url, String name, String value) {
String portletId = HttpUtil.getParameter(url, "p_p_id", false);
if (Validator.isNotNull(portletId)) {
name = PortalUtil.getPortletNamespace(portletId) + name;
}
return HttpUtil.addParameter(url, name, value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment