01: /*
02: * (C) Copyright 2000 - 2006 Nabh Information Systems, Inc.
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: *
18: */
19: package com.nabhinc.portal.processor;
20:
21: import java.io.IOException;
22:
23: import javax.servlet.ServletException;
24: import javax.servlet.http.HttpServletRequest;
25: import javax.servlet.http.HttpServletResponse;
26: import javax.servlet.http.HttpSession;
27:
28: import com.nabhinc.portal.core.NavigationState;
29: import com.nabhinc.portal.core.PortalConstants;
30: import com.nabhinc.portal.core.PortalUtil;
31: import com.nabhinc.portal.core.SessionCache;
32: import com.nabhinc.portal.model.PortalApplicationView;
33: import com.nabhinc.portal.model.PortalPage;
34: import com.nabhinc.portal.model.PortalPageState;
35: import com.nabhinc.portal.model.PortletWindow;
36:
37: /**
38: *
39: *
40: * @author Padmanabh Dabke
41: * (c) 2006 Nabh Information Systems, Inc. All Rights Reserved.
42: */
43: public class DetachProcessor extends BasePortalActionProcessor {
44:
45: public void process(HttpServletRequest request,
46: HttpServletResponse response, SessionCache sCache,
47: PortalApplicationView portalAppView,
48: PortalPageState pageState, int startIndex,
49: String[] portalParams, String displayMode,
50: String targetWindowId, boolean isAJAXRequest)
51: throws ServletException, IOException {
52:
53: PortalPage targetPage = pageState.portalPage;
54: if (portalParams.length > startIndex) {
55: targetWindowId = portalParams[startIndex];
56: startIndex++;
57: }
58:
59: PortletWindow targetWindow = (PortletWindow) targetPage
60: .getPortletWindow(targetWindowId);
61: if (targetWindow == null) {
62: // response.setStatus(HttpServletResponse.SC_NOT_FOUND);
63: response.sendError(HttpServletResponse.SC_NOT_FOUND);
64: } else {
65: HttpSession session = request.getSession();
66: NavigationState navState = NavigationState
67: .getNavigationState(session, targetWindow.getId(),
68: false);
69: if (navState != null) {
70: navState = navState.copy();
71: NavigationState.setNavigationState(session,
72: targetWindow.getId(), true, navState);
73: }
74: sCache.renderResponse.setBaseURL(PortalUtil
75: .computeDetachedURL(request, targetPage,
76: targetWindowId));
77: sCache.renderResponse.setDetached(true);
78: request.setAttribute(
79: PortalConstants.CURRENT_RENDERABLE_ATTRIBUTE,
80: targetWindow);
81: request.getRequestDispatcher(
82: portalAppView.getPortalApplication()
83: .getDisplayInfo().detachedTemplate)
84: .include(request, response);
85: }
86:
87: }
88:
89: }
|