01: /*
02: * Copyright 2005 jWic group (http://www.jwic.de)
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: *
16: * de.jwic.base.RenderContext
17: * Created on 04.12.2005
18: * $Id: RenderContext.java,v 1.1 2006/01/16 08:30:40 lordsam Exp $
19: */
20: package de.jwic.base;
21:
22: import java.io.IOException;
23: import java.io.PrintWriter;
24:
25: import javax.servlet.http.HttpServletRequest;
26: import javax.servlet.http.HttpServletResponse;
27:
28: /**
29: * The render context contains the request and response objects required by
30: * renderer implementations to render a control. The context is given from one
31: * renderer to the other.
32: *
33: * @author Florian Lippisch
34: * @version $Revision: 1.1 $
35: */
36: public class RenderContext {
37:
38: private HttpServletRequest request;
39: private HttpServletResponse response;
40: private PrintWriter writer;
41:
42: /**
43: * Constructs a new RenderContext.
44: * @param request
45: * @param response
46: * @throws IOException
47: */
48: public RenderContext(HttpServletRequest request,
49: HttpServletResponse response) throws IOException {
50: this .request = request;
51: this .response = response;
52: writer = response.getWriter();
53: }
54:
55: /**
56: * Constructs a new RenderContext, using a custom writer.
57: * @param request
58: * @param response
59: * @throws IOException
60: */
61: public RenderContext(HttpServletRequest request,
62: HttpServletResponse response, PrintWriter writer) {
63: this .request = request;
64: this .response = response;
65: this .writer = writer;
66: }
67:
68: /**
69: * @return Returns the request.
70: */
71: public HttpServletRequest getRequest() {
72: return request;
73: }
74:
75: /**
76: * @return Returns the response.
77: */
78: public HttpServletResponse getResponse() {
79: return response;
80: }
81:
82: /**
83: * Returns the writer.
84: * @return
85: */
86: public PrintWriter getWriter() {
87: return writer;
88: }
89:
90: }
|