Some redirects executed from a custom module are not performed in JBoss EAP/Wildfly
Written By
Daniel Mijarra
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
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.
Did this article resolve your issue ?