1/*2 * Licensed to the Apache Software Foundation (ASF) under one or more3 * contributor license agreements. See the NOTICE file distributed with4 * this work for additional information regarding copyright ownership.5 * The ASF licenses this file to You under the Apache License, Version 2.06 * (the "License"); you may not use this file except in compliance with7 * the License. You may obtain a copy of the License at8 * 9 * http://www.apache.org/licenses/LICENSE-2.010 * 11 * Unless required by applicable law or agreed to in writing, software12 * distributed under the License is distributed on an "AS IS" BASIS,13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14 * See the License for the specific language governing permissions and15 * limitations under the License.16 */17packageorg.apache.jetspeed.messaging;
1819import java.io.IOException;
2021import javax.portlet.ActionRequest;
22import javax.portlet.ActionResponse;
23import javax.portlet.PortletException;
24import javax.servlet.http.HttpServletRequest;
25import javax.servlet.http.HttpServletResponse;
2627import org.apache.jetspeed.container.window.PortletWindowAccessor;
28import org.apache.jetspeed.request.RequestContext;
29import org.apache.pluto.PortletContainerServices;
30import org.apache.pluto.factory.PortletObjectAccess;
31import org.apache.pluto.invoker.PortletInvoker;
32import org.apache.pluto.invoker.PortletInvokerAccess;
33import org.apache.pluto.om.window.PortletWindow;
343536/***37 * Message 38 *39 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>40 * @version $Id: $41 */42publicclassPortletMessagingImpl43 {
44private PortletWindowAccessor windowAccessor;
45private PortletInvoker invoker;
46private ActionRequest actionRequest;
47private ActionResponse actionResponse;
4849publicPortletMessagingImpl(PortletWindowAccessor windowAccessor)
50 {
51this.windowAccessor = windowAccessor;
52 }
5354publicvoid processActionMessage(String portletName, RequestContext jetspeedRequest)
55 throws PortletException, IOException
56 {
57//RequestContext jetspeedRequest = (RequestContext)request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);58 PortletContainerServices.prepare("Jetspeed");
5960 PortletWindow window = windowAccessor.getPortletWindow("psd-1");
61 HttpServletRequest requestForWindow = jetspeedRequest.getRequestForWindow(window);
62 HttpServletResponse responseForWindow = jetspeedRequest.getResponseForWindow(window);
6364 actionRequest = PortletObjectAccess.getActionRequest(window, requestForWindow, responseForWindow);
65 actionResponse = PortletObjectAccess.getActionResponse(window, requestForWindow, responseForWindow);
6667 invoker = PortletInvokerAccess.getPortletInvoker(window.getPortletEntity().getPortletDefinition());
6869 invoker.action(actionRequest, actionResponse);
7071 PortletContainerServices.release();
72 }
7374 }