001    // Copyright 2004, 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.services.impl;
016    
017    import javax.servlet.http.HttpServletRequest;
018    import javax.servlet.http.HttpServletResponse;
019    
020    import org.apache.tapestry.services.RequestGlobals;
021    import org.apache.tapestry.web.WebRequest;
022    import org.apache.tapestry.web.WebResponse;
023    
024    /**
025     * Wrapper around {@link org.apache.hivemind.service.ThreadLocalStorage}used to store and retrieve
026     * Servlet API info.
027     * 
028     * @author Howard Lewis Ship
029     * @since 4.0
030     */
031    public class RequestGlobalsImpl implements RequestGlobals
032    {
033        private WebRequest _webRequest;
034    
035        private WebResponse _webResponse;
036    
037        private HttpServletRequest _request;
038    
039        private HttpServletResponse _response;
040    
041        public WebRequest getWebRequest()
042        {
043            return _webRequest;
044        }
045    
046        public WebResponse getWebResponse()
047        {
048            return _webResponse;
049        }
050    
051        public HttpServletRequest getRequest()
052        {
053            return _request;
054        }
055    
056        public HttpServletResponse getResponse()
057        {
058            return _response;
059        }
060    
061        public void store(WebRequest request, WebResponse response)
062        {
063            _webRequest = request;
064            _webResponse = response;
065        }
066    
067        public void store(HttpServletRequest request, HttpServletResponse response)
068        {
069            _request = request;
070            _response = response;
071        }
072    }