List of usage examples for com.liferay.portal.kernel.portlet LiferayPortletURL getPortletId
public String getPortletId();
From source file:com.liferay.portlet.PortletURLUtil.java
License:Open Source License
public static PortletURL clone(LiferayPortletURL liferayPortletURL, String lifecycle, MimeResponse mimeResponse) throws PortletException { LiferayPortletURL newURLImpl = null; if (lifecycle.equals(PortletRequest.ACTION_PHASE)) { newURLImpl = (LiferayPortletURL) mimeResponse.createActionURL(); } else if (lifecycle.equals(PortletRequest.RENDER_PHASE)) { newURLImpl = (LiferayPortletURL) mimeResponse.createRenderURL(); }/*from ww w . j av a 2s . c o m*/ newURLImpl.setPortletId(liferayPortletURL.getPortletId()); WindowState windowState = liferayPortletURL.getWindowState(); if (windowState != null) { newURLImpl.setWindowState(windowState); } PortletMode portletMode = liferayPortletURL.getPortletMode(); if (portletMode != null) { newURLImpl.setPortletMode(portletMode); } newURLImpl.setParameters(liferayPortletURL.getParameterMap()); return newURLImpl; }
From source file:com.liferay.util.bridges.wai.WAIFriendlyURLMapper.java
License:Open Source License
public String buildPath(LiferayPortletURL liferayPortletURL) { String portletId = liferayPortletURL.getPortletId(); String prefix = portletId;/* www .j a v a 2s.c o m*/ int pos = portletId.indexOf(PortletConstants.WAR_SEPARATOR); if (pos != -1) { prefix = portletId.substring(0, pos); } String appUrl = GetterUtil.getString(liferayPortletURL.getParameter("appURL")); liferayPortletURL.addParameterIncludedInPath("p_p_id"); return StringPool.SLASH + _MAPPING + StringPool.SLASH + prefix + StringPool.SLASH + appUrl; }
From source file:com.liferay.wsrp.consumer.portlet.ConsumerFriendlyURLMapper.java
License:Open Source License
@Override public String buildPath(LiferayPortletURL liferayPortletURL) { StringBuilder sb = new StringBuilder(); sb.append("/consumer"); addPathElement(sb, liferayPortletURL.getPortletId()); liferayPortletURL.addParameterIncludedInPath("p_p_id"); WindowState windowState = liferayPortletURL.getWindowState(); if (windowState != null) { addPathElement(sb, windowState.toString()); } else {/*from w w w . j ava2s . c om*/ addPathElement(sb, null); } liferayPortletURL.addParameterIncludedInPath("p_p_state"); PortletMode portletMode = liferayPortletURL.getPortletMode(); if (portletMode != null) { addPathElement(sb, portletMode.toString()); } else { addPathElement(sb, null); } liferayPortletURL.addParameterIncludedInPath("p_p_mode"); addPathElement(sb, liferayPortletURL.getCacheability()); liferayPortletURL.addParameterIncludedInPath("p_p_cacheability"); Map<String, String[]> parameterMap = liferayPortletURL.getParameterMap(); String[] navigationalState = parameterMap.get("wsrp-navigationalState"); if ((navigationalState == null) || (navigationalState.length <= 0)) { navigationalState = new String[] { null }; } addPathElement(sb, navigationalState[0]); liferayPortletURL.addParameterIncludedInPath("wsrp-navigationalState"); return sb.toString(); }
From source file:com.liferay.wsrp.portlet.ConsumerFriendlyURLMapper.java
License:Open Source License
public String buildPath(LiferayPortletURL liferayPortletURL) { StringBuilder sb = new StringBuilder(); sb.append("/consumer"); addPathElement(sb, liferayPortletURL.getPortletId()); liferayPortletURL.addParameterIncludedInPath("p_p_id"); WindowState windowState = liferayPortletURL.getWindowState(); if (windowState != null) { addPathElement(sb, windowState.toString()); } else {/* w w w .jav a 2 s. com*/ addPathElement(sb, null); } liferayPortletURL.addParameterIncludedInPath("p_p_state"); PortletMode portletMode = liferayPortletURL.getPortletMode(); if (portletMode != null) { addPathElement(sb, portletMode.toString()); } else { addPathElement(sb, null); } liferayPortletURL.addParameterIncludedInPath("p_p_mode"); addPathElement(sb, liferayPortletURL.getCacheability()); liferayPortletURL.addParameterIncludedInPath("p_p_cacheability"); Map<String, String[]> parameterMap = liferayPortletURL.getParameterMap(); String[] navigationalState = parameterMap.get("wsrp-navigationalState"); if ((navigationalState == null) || (navigationalState.length <= 0)) { navigationalState = new String[] { null }; } addPathElement(sb, navigationalState[0]); liferayPortletURL.addParameterIncludedInPath("wsrp-navigationalState"); return sb.toString(); }
From source file:com.vportal.portlet.vcms.util.VCMSFriendlyURLMapper.java
License:Open Source License
public String buildPath(LiferayPortletURL portletURL) { // TODO Auto-generated method stub String friendlyURLPath = null; String portletId = portletURL.getPortletId(); VcmsArticle article = null;//w ww. j a v a2 s .c om VcmsCategory category = null; try { String articleId = GetterUtil.getString(portletURL.getParameter("articleId"), "0"); String categoryId = GetterUtil.getString(portletURL.getParameter("categoryId"), "0"); if (!Validator.equals(articleId, "0") || !Validator.equals(categoryId, "0")) { if (portletId.equals(_PORTLET_DEFAULT_INSTANCE)) { portletId = _PORTLET_ID; } String[] arrInstance = StringUtil.split(portletId, "_"); // friendlyURLPath = "/vcmsviewcontent/" + arrInstance[2]; friendlyURLPath = StringPool.FORWARD_SLASH + getMapping() + StringPool.FORWARD_SLASH + arrInstance[4]; portletURL.addParameterIncludedInPath("p_p_id"); portletURL.addParameterIncludedInPath("p_p_lifecycle"); // portletURL.addParameterIncludedInPath("p_p_state");// k co // portletURL.addParameterIncludedInPath("p_p_mode");// k co portletURL.addParameterIncludedInPath("p_p_col_id"); portletURL.addParameterIncludedInPath("p_p_col_count"); portletURL.addParameterIncludedInPath("p_p_col_pos"); portletURL.addParameterIncludedInPath("jspPage"); if (!categoryId.equalsIgnoreCase("0")) { friendlyURLPath += StringPool.FORWARD_SLASH + categoryId; portletURL.addParameterIncludedInPath("categoryId"); } if (!articleId.equalsIgnoreCase("0")) { friendlyURLPath += StringPool.FORWARD_SLASH + articleId; portletURL.addParameterIncludedInPath("articleId"); } if (!articleId.equalsIgnoreCase("0")) { article = VcmsArticleServiceUtil.getArticle(articleId); friendlyURLPath += StringPool.FORWARD_SLASH + Normalizer.normalize(article.getTitle(), Normalizer.Form.NFD) .replaceAll("[^\\p{ASCII}]", "") // .replaceAll("-", "") // .replaceAll(" ", "-") .replaceAll("[^a-zA-Z0-9-]", "-").replaceAll("-{2,}", "-").toLowerCase() + ".html"; } if (!categoryId.equalsIgnoreCase("0") && articleId.equalsIgnoreCase("0")) { category = VcmsCategoryServiceUtil.getCategory(categoryId); friendlyURLPath += StringPool.FORWARD_SLASH + Normalizer.normalize(category.getName(), Normalizer.Form.NFD) .replaceAll("[^\\p{ASCII}]", "") // .replaceAll("-", "") // .replaceAll("\\b\\s{1,}\\b", "-") .replaceAll("[^a-zA-Z0-9-]", "-").replaceAll("-{2,}", "-").toLowerCase() + ".html"; } } } catch (PortalException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } return friendlyURLPath; }