我想在 liferay 中为我的 JSR-268 Portlet 启用友好的 url。
我在http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/FriendlyURLMapper中告诉我配置了友好的 url 映射器,但不知何故这对我不起作用。
我错过了什么?
我的liferay-portlet.xml
样子是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.1.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_1_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>content</portlet-name>
<friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
<friendly-url-mapping>content</friendly-url-mapping>
<friendly-url-routes>com/gentics/cr/portlet/content-url-routes.xml</friendly-url-routes>
<instanceable>true</instanceable>
</portlet>
<portlet>
<portlet-name>navigation</portlet-name>
<icon>/icon.png</icon>
<instanceable>true</instanceable>
</portlet>
<portlet>
<portlet-name>search</portlet-name>
<icon>/icon.png</icon>
<instanceable>true</instanceable>
<!-- header-portlet-css>/css/test.css</header-portlet-css>
<footer-portlet-javascript>/js/test.js</footer-portlet-javascript-->
</portlet>
<!--role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper-->
</liferay-portlet-app>
我的content-url-routes.xml
样子是这样的:
<?xml version="1.0"?>
<!DOCTYPE routes PUBLIC "-//Liferay//DTD Friendly URL Routes 6.0.0//EN" "http://www.liferay.com/dtd/liferay-friendly-url-routes_6_0_0.dtd">
<routes>
<route>
<pattern>/content/{contentid}</pattern>
</route>
<!-- route>
<pattern>/{instanceId}/search/{filter}</pattern>
<implicit-parameter name="do">search</implicit-parameter>
</route>
<route>
<pattern>/{instanceId}/search/{filter}/{start}</pattern>
<implicit-parameter name="do">search</implicit-parameter>
</route-->
</routes>
portlet 中呈现的 url 仍然是:http://localhost:8080/web/guest/home?p_auth=Yu81QQrj&p_p_id=content_WAR_genticsportlet_INSTANCE_R2HSaoL5RkHi&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-2&p_p_col_count=1&_content_WAR_genticsportlet_INSTANCE_R2HSaoL5RkHi_contentid=10007.33
该 URL 是使用以下代码创建的:
PortletURL actionURL = response.createActionURL();
actionURL.setParameter("contentid", "10007.33");
如果您能指出我正确的方向,那就太好了...