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.
Contenido exclusivo para suscriptores.
Una Suscripción Enterprise de Liferay proporciona acceso a más de 1.500 artículos que incluyen las mejores practicas, diagnóstico de problemas y otras soluciones útiles. Inicia sesión para tener un acceso completo.
Inicia sesión