portletWindow.getContextPath()), portletWindow);
debugWithName("Action request received for portlet: "
+ portletWindow.getPortletName());
InternalActionRequest actionRequest = getOptionalContainerServices().getPortletEnvironmentService()
.createActionRequest(this, request, response, internalPortletWindow);
InternalActionResponse actionResponse = getOptionalContainerServices().getPortletEnvironmentService()
.createActionResponse(this, request, response, internalPortletWindow);
PortletInvokerService invoker = optionalContainerServices.getPortletInvokerService();
try {
ContainerInvocation.setInvocation(this, internalPortletWindow);
invoker.action(actionRequest, actionResponse, internalPortletWindow);
}
finally {
ContainerInvocation.clearInvocation();
}
debugWithName("Portlet action processed for: "
+ portletWindow.getPortletName());
// After processing action, send a redirect URL for rendering.
String location = actionResponse.getRedirectLocation();
if (location == null) {
// Create portlet URL provider to encode redirect URL.
debugWithName("No redirect location specified.");
PortletURLProvider redirectURL = requiredContainerServices
.getPortalCallbackService()
.getPortletURLProvider(request, internalPortletWindow);
// Encode portlet mode if it is changed.
if (actionResponse.getChangedPortletMode() != null) {
redirectURL.setPortletMode(
actionResponse.getChangedPortletMode());
}
// Encode window state if it is changed.
if (actionResponse.getChangedWindowState() != null) {
redirectURL.setWindowState(
actionResponse.getChangedWindowState());
}
// Encode render parameters retrieved from action response.
Map renderParameters = actionResponse.getRenderParameters();
redirectURL.clearParameters();
redirectURL.setParameters(renderParameters);
// Encode redirect URL as a render URL.
redirectURL.setAction(false);
// Set secure of the redirect URL if necessary.
if (actionRequest.isSecure()) {
redirectURL.setSecure();
}
// Encode the redirect URL to a string.
location = actionResponse.encodeRedirectURL(redirectURL.toString());