01: // Copyright 2006, 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.internal.services;
16:
17: import static org.apache.tapestry.ioc.IOCConstants.PERTHREAD_SCOPE;
18:
19: import javax.servlet.http.HttpServletRequest;
20: import javax.servlet.http.HttpServletResponse;
21:
22: import org.apache.tapestry.ioc.annotations.Scope;
23: import org.apache.tapestry.services.Request;
24: import org.apache.tapestry.services.RequestGlobals;
25: import org.apache.tapestry.services.Response;
26:
27: /**
28: * Dumb data holder for per-request data.
29: */
30: @Scope(PERTHREAD_SCOPE)
31: public class RequestGlobalsImpl implements RequestGlobals {
32: private HttpServletRequest _servletRequest;
33:
34: private HttpServletResponse _servletResponse;
35:
36: private Request _request;
37:
38: private Response _response;
39:
40: public void store(HttpServletRequest request,
41: HttpServletResponse response) {
42: _servletRequest = request;
43: _servletResponse = response;
44: }
45:
46: public HttpServletRequest getHTTPServletRequest() {
47: return _servletRequest;
48: }
49:
50: public HttpServletResponse getHTTPServletResponse() {
51: return _servletResponse;
52: }
53:
54: public void store(Request request, Response response) {
55: _request = request;
56: _response = response;
57: }
58:
59: public Request getRequest() {
60: return _request;
61: }
62:
63: public Response getResponse() {
64: return _response;
65: }
66:
67: }
|