Some redirects executed from a custom module are not performed in JBoss EAP/Wildfly

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.

 

この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています