List of usage examples for com.liferay.portal.kernel.portlet LiferayPortletURL addParameterIncludedInPath
public void addParameterIncludedInPath(String name);
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;//ww w . j a v a 2 s . co 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.wol.meetups.portlet.MeetupsFriendlyURLMapper.java
License:Open Source License
public String buildPath(LiferayPortletURL portletURL) { String jspPage = GetterUtil.getString(portletURL.getParameter("jspPage")); long meetupsEntryId = GetterUtil.getLong(portletURL.getParameter("meetupsEntryId")); if ((jspPage.equals("/meetups/view_entry.jsp")) && (meetupsEntryId > 0)) { portletURL.addParameterIncludedInPath("p_p_id"); portletURL.addParameterIncludedInPath("jspPage"); portletURL.addParameterIncludedInPath("meetupsEntryId"); StringBuilder sb = new StringBuilder(); sb.append(StringPool.SLASH);//from w w w .j a v a 2s. c om sb.append(_MAPPING); sb.append("/entry/"); sb.append(meetupsEntryId); return sb.toString(); } return null; }
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 www . ja v a2s. c o m*/ 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 {/*from w ww .j a va 2 s .co m*/ 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;/*from w w w. j a v a 2 s. co m*/ 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; }
From source file:de.uhh.l2g.util.GuestLectureseriesFriendlyURLMapper.java
License:Open Source License
/** * Builds the path./* w ww .j a va2 s. c om*/ * * @param portletURL the portlet url * @return the string */ public String buildPath(LiferayPortletURL portletURL) { String friendlyURLPath = null; String videoId = portletURL.getParameter("videoId"); // videoId if (videoId != null && !videoId.equals("")) { friendlyURLPath = "/v/" + videoId; } if (Validator.isNotNull(friendlyURLPath)) { portletURL.addParameterIncludedInPath("p_p_id"); portletURL.addParameterIncludedInPath("p_p_lifecycle"); portletURL.addParameterIncludedInPath("p_p_state"); portletURL.addParameterIncludedInPath("p_p_mode"); portletURL.addParameterIncludedInPath("p_p_col_id"); portletURL.addParameterIncludedInPath("p_p_col_count"); portletURL.addParameterIncludedInPath("videoId"); portletURL.addParameterIncludedInPath("method"); portletURL.addParameterIncludedInPath("clipStartTime"); portletURL.addParameterIncludedInPath("clipEndTime"); portletURL.addParameterIncludedInPath("facultyId"); portletURL.addParameterIncludedInPath("subFacility1Id"); portletURL.addParameterIncludedInPath("subFacility2Id"); portletURL.addParameterIncludedInPath("lectureseriesId"); } return friendlyURLPath; }
From source file:de.uhh.l2g.util.GuestSearchFriendlyURLMapper.java
License:Open Source License
/** * Builds the path.//from w w w. j a v a 2 s. c om * * @param portletURL the portlet url * @return the string */ public String buildPath(LiferayPortletURL portletURL) { String friendlyURLPath = null; String videoId = portletURL.getParameter("videoId"); // videoId if (videoId != null && !videoId.equals("")) { friendlyURLPath = "/s/" + videoId; } if (Validator.isNotNull(friendlyURLPath)) { portletURL.addParameterIncludedInPath("p_p_id"); portletURL.addParameterIncludedInPath("p_p_lifecycle"); portletURL.addParameterIncludedInPath("p_p_state"); portletURL.addParameterIncludedInPath("p_p_mode"); portletURL.addParameterIncludedInPath("p_p_col_id"); portletURL.addParameterIncludedInPath("p_p_col_count"); portletURL.addParameterIncludedInPath("videoId"); portletURL.addParameterIncludedInPath("method"); portletURL.addParameterIncludedInPath("facultyId"); portletURL.addParameterIncludedInPath("subFacility1Id"); portletURL.addParameterIncludedInPath("subFacility2Id"); portletURL.addParameterIncludedInPath("lectureseriesId"); } return friendlyURLPath; }
From source file:de.uhh.l2g.util.StudentFriendlyURLMapper.java
License:Open Source License
/** * Builds the path./*from w ww . java2 s. co m*/ * * @param portletURL the portlet url * @return the string */ public String buildPath(LiferayPortletURL portletURL) { String friendlyURLPath = null; String videoId = portletURL.getParameter("videoId"); // videoId if (videoId != null && !videoId.equals("")) { friendlyURLPath = "/sv/" + videoId.split("\\.")[0]; } if (Validator.isNotNull(friendlyURLPath)) { portletURL.addParameterIncludedInPath("p_p_id"); portletURL.addParameterIncludedInPath("p_p_lifecycle"); portletURL.addParameterIncludedInPath("p_p_state"); portletURL.addParameterIncludedInPath("p_p_mode"); portletURL.addParameterIncludedInPath("p_p_col_id"); portletURL.addParameterIncludedInPath("p_p_col_count"); portletURL.addParameterIncludedInPath("videoId"); portletURL.addParameterIncludedInPath("method"); portletURL.addParameterIncludedInPath("facultyId"); portletURL.addParameterIncludedInPath("subFacility1Id"); portletURL.addParameterIncludedInPath("subFacility2Id"); portletURL.addParameterIncludedInPath("lectureseriesId"); } return friendlyURLPath; }