Issue
- Given a custom module with a portlet component which includes the following code:
...
@Override
public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
HttpServletResponse response= PortalUtil.getHttpServletResponse(renderResponse);
response.sendRedirect("http://localhost:8080/my-redirect-page");
}
...
- The redirect is not effective when the module is deployed into a JBoss EAP/Wildfly application server.
Environment
- Quarterly Release: 2023.Q3, 2023.Q4, 2024.Q1, 2024.Q2
- DXP 7.4
Resolution
- JBoss EAP and Wildfly application servers does not allow to perform redirects when the portlet is in render phase, which is aligned with Java Portlet specifications. However, other application servers like Tomcat do not enforce this restriction allowing such redirects.
- It is not recommended to redirect at the time that the portlet is rendered since there might already be content committed to the output stream by other portlets.
- When the action phase is executed, it only targets to one portlet, being the most suitable place to perform redirects.
会員限定記事
Liferay エンタープライズ サブスクリプションをお持ちのお客様は1500件を超えるベストプラクティス、トラブルシューティング、その他のソリューション記事を閲覧できます。ログインすると、記事全体をお読みいただけます。
ログイン