portletWindow.setChannelRuntimeData(rd);
portletWindow.setHttpServletRequest(wrappedRequest);
// Get the portlet url manager which will analyze the request parameters
DynamicInformationProvider dip = InformationProviderAccess.getDynamicProvider(wrappedRequest);
PortletStateManager psm = ((DynamicInformationProviderImpl)dip).getPortletStateManager(portletWindow);
PortletActionProvider pap = dip.getPortletActionProvider(portletWindow);
//If portlet is rendering as root, change mode to maximized, otherwise minimized
WindowState newWindowState = cd.getNewWindowState();
if (!psm.isAction() && rd.isRenderingAsRoot()) {
if (WindowState.MINIMIZED.equals(newWindowState)) {
pap.changePortletWindowState(WindowState.MINIMIZED);
}
else {
pap.changePortletWindowState(WindowState.MAXIMIZED);
}
} else if (newWindowState != null) {
pap.changePortletWindowState(newWindowState);
}
else if (!psm.isAction()) {
pap.changePortletWindowState(WindowState.NORMAL);
}
cd.setNewWindowState(null);
//Check for a portlet mode change
PortletMode newMode = cd.getNewPortletMode();
if (newMode != null) {
pap.changePortletMode(newMode);
PortletStateManager.setMode(portletWindow, newMode);
}
cd.setNewPortletMode(null);
// Process action if this is the targeted channel and the URL is an action URL
if (rd.isTargeted() && psm.isAction()) {
//Create a sink to throw out and output (portlets can't output content during an action)
PrintWriter pw = new PrintWriter(new NullOutputStream());
HttpServletResponse wrappedResponse = ServletObjectAccess.getStoredServletResponse(pcs.getHttpServletResponse(), pw);
try {