PortletURLProviderImpl event = (PortletURLProviderImpl) objectModel.get("portlet-event");
if ( event != null ) {
PortletWindow actionWindow = event.getPortletWindow();
try {
final ServletRequestImpl req = (ServletRequestImpl) objectModel.get("portlet-request");
final ServletResponseImpl res= (ServletResponseImpl)objectModel.get("portlet-response");
this.portletContainer.processPortletAction(actionWindow, req.getRequest(actionWindow), res);
// this redirect is only for 2.1.x, don't add it to 2.2
// (see #32157 for more information)
final String redirectURL = res.getRedirectURL();
HttpServletResponse response = (HttpServletResponse) objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
response.sendRedirect(redirectURL);
} catch (Exception ignore) {
this.getLogger().error("Error during processing of portlet action.", ignore);
}
} else if ( objectModel.get("portlet-response") == null ) {
final HttpServletResponse res = (HttpServletResponse) objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
objectModel.put("portlet-response", new ServletResponseImpl(res));
final ServletRequestImpl req = new ServletRequestImpl((HttpServletRequest) objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT), null);
objectModel.put("portlet-request", req);
}
}