001
014
015 package com.liferay.portlet.tagscompiler;
016
017 import com.liferay.portal.kernel.portlet.BaseFriendlyURLMapper;
018 import com.liferay.portal.kernel.portlet.LiferayPortletURL;
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.kernel.util.StringUtil;
022
023 import java.util.Map;
024
025 import javax.portlet.PortletMode;
026 import javax.portlet.WindowState;
027
028
031 public class TagsCompilerFriendlyURLMapper extends BaseFriendlyURLMapper {
032
033 public String buildPath(LiferayPortletURL liferayPortletURL) {
034 return null;
035 }
036
037 public boolean isCheckMappingWithPrefix() {
038 return _CHECK_MAPPING_WITH_PREFIX;
039 }
040
041 public void populateParams(
042 String friendlyURLPath, Map<String, String[]> parameterMap,
043 Map<String, Object> requestContext) {
044
045 addParameter(parameterMap, "p_p_id", getPortletId());
046 addParameter(parameterMap, "p_p_lifecycle", "0");
047 addParameter(parameterMap, "p_p_state", WindowState.NORMAL);
048 addParameter(parameterMap, "p_p_mode", PortletMode.VIEW);
049
050 int x = friendlyURLPath.indexOf(StringPool.SLASH, 1);
051 int y = friendlyURLPath.length();
052
053 String[] entries = StringUtil.split(
054 friendlyURLPath.substring(x + 1, y), StringPool.SLASH);
055
056 if (entries.length > 0) {
057 StringBundler sb = new StringBundler(entries.length * 2 - 1);
058
059 for (int i = 0; i < entries.length; i++) {
060 String entry = StringUtil.replace(
061 entries[i], StringPool.PLUS, StringPool.SPACE);
062
063 if (i != 0) {
064 sb.append(StringPool.COMMA);
065 }
066
067 sb.append(entry);
068 }
069
070 addParameter(parameterMap, "entries", sb.toString());
071 }
072 }
073
074 private static final boolean _CHECK_MAPPING_WITH_PREFIX = false;
075
076 }