1
19
20 package com.liferay.portal.kernel.portlet;
21
22 import com.liferay.portal.kernel.util.GetterUtil;
23 import com.liferay.portal.kernel.util.StringPool;
24 import com.liferay.portal.kernel.util.Validator;
25
26 import java.util.Map;
27
28 import javax.portlet.PortletMode;
29
30
36 public abstract class RSSFriendlyURLMapper extends BaseFriendlyURLMapper {
37
38 public String buildPath(LiferayPortletURL portletURL) {
39 String friendlyURLPath = null;
40
41 boolean rss = GetterUtil.getBoolean(portletURL.getParameter("rss"));
42
43 if (rss) {
44 friendlyURLPath = StringPool.SLASH + getMapping() + "/rss";
45
46 portletURL.addParameterIncludedInPath("rss");
47 }
48
49 if (Validator.isNotNull(friendlyURLPath)) {
50 portletURL.addParameterIncludedInPath("p_p_id");
51 }
52
53 return friendlyURLPath;
54 }
55
56 public void populateParams(
57 String friendlyURLPath, Map<String, String[]> params) {
58
59 int x = friendlyURLPath.indexOf(StringPool.SLASH, 1);
60
61 if (x == -1) {
62 return;
63 }
64
65 String rss = friendlyURLPath.substring(x + 1);
66
67 if (!rss.equals("rss")) {
68 return;
69 }
70
71 addParam(params, "p_p_id", getPortletId());
72 addParam(params, "p_p_lifecycle", "0");
73 addParam(params, "p_p_state", LiferayWindowState.EXCLUSIVE);
74 addParam(params, "p_p_mode", PortletMode.VIEW);
75 }
76
77 }