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