001    // Copyright 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry.portlet;
016    
017    import javax.portlet.ActionRequest;
018    import javax.portlet.ActionResponse;
019    import javax.portlet.PortletRequest;
020    import javax.portlet.RenderRequest;
021    import javax.portlet.RenderResponse;
022    
023    /**
024     * Implementation of the tapestry.portlet.PortletRequestGlobals service, which uses the threaded
025     * service lifecycle model.
026     * 
027     * @author Howard M. Lewis Ship
028     * @since 4.0
029     */
030    public class PortletRequestGlobalsImpl implements PortletRequestGlobals
031    {
032        private ActionRequest _actionRequest;
033    
034        private ActionResponse _actionResponse;
035    
036        private RenderResponse _renderResponse;
037    
038        private RenderRequest _renderRequest;
039    
040        private PortletRequest _portletRequest;
041    
042        public void store(ActionRequest request, ActionResponse response)
043        {
044            _actionRequest = request;
045            _portletRequest = request;
046    
047            _actionResponse = response;
048        }
049    
050        public void store(RenderRequest request, RenderResponse response)
051        {
052            _renderRequest = request;
053            _portletRequest = request;
054    
055            _renderResponse = response;
056        }
057    
058        public ActionRequest getActionRequest()
059        {
060            return _actionRequest;
061        }
062    
063        public ActionResponse getActionResponse()
064        {
065            return _actionResponse;
066        }
067    
068        public RenderRequest getRenderRequest()
069        {
070            return _renderRequest;
071        }
072    
073        public RenderResponse getRenderResponse()
074        {
075            return _renderResponse;
076        }
077    
078        public boolean isRenderRequest()
079        {
080            return _renderRequest != null;
081        }
082    
083        public PortletRequest getPortletRequest()
084        {
085            return _portletRequest;
086        }
087    }