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 @Override
039 public boolean isCheckMappingWithPrefix() {
040 return _CHECK_MAPPING_WITH_PREFIX;
041 }
042
043 public void populateParams(
044 String friendlyURLPath, Map<String, String[]> parameterMap,
045 Map<String, Object> requestContext) {
046
047 addParameter(parameterMap, "p_p_id", getPortletId());
048 addParameter(parameterMap, "p_p_lifecycle", "0");
049 addParameter(parameterMap, "p_p_state", WindowState.NORMAL);
050 addParameter(parameterMap, "p_p_mode", PortletMode.VIEW);
051
052 int x = friendlyURLPath.indexOf(CharPool.SLASH, 1);
053 int y = friendlyURLPath.length();
054
055 String[] entries = StringUtil.split(
056 friendlyURLPath.substring(x + 1, y), CharPool.SLASH);
057
058 if (entries.length > 0) {
059 StringBundler sb = new StringBundler(entries.length * 2 - 1);
060
061 for (int i = 0; i < entries.length; i++) {
062 String entry = StringUtil.replace(
063 entries[i], CharPool.PLUS, CharPool.SPACE);
064
065 if (i != 0) {
066 sb.append(StringPool.COMMA);
067 }
068
069 sb.append(entry);
070 }
071
072 addParameter(parameterMap, "entries", sb.toString());
073 }
074 }
075
076 private static final boolean _CHECK_MAPPING_WITH_PREFIX = false;
077
078 }