2011/08/05 - Jakarta Cactus has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.cactus.server;
22
23 import java.io.IOException;
24
25 import java.lang.reflect.Constructor;
26
27 import java.util.Enumeration;
28
29 import javax.servlet.Servlet;
30 import javax.servlet.ServletConfig;
31 import javax.servlet.ServletContext;
32 import javax.servlet.ServletException;
33 import javax.servlet.ServletRequest;
34 import javax.servlet.ServletResponse;
35 import javax.servlet.http.HttpServletRequest;
36 import javax.servlet.http.HttpSession;
37 import javax.servlet.jsp.JspWriter;
38 import javax.servlet.jsp.PageContext;
39 import javax.servlet.jsp.tagext.BodyContent;
40
41 import org.apache.cactus.ServletURL;
42 import org.apache.cactus.util.ChainedRuntimeException;
43
44
45
46
47
48
49
50
51 public abstract class AbstractPageContextWrapper extends PageContext
52 {
53
54
55
56 protected PageContext originalPageContext;
57
58
59
60
61 protected ServletURL url;
62
63
64
65
66
67
68
69
70
71
72 public AbstractPageContextWrapper(PageContext theOriginalPageContext,
73 ServletURL theURL)
74 {
75 this.originalPageContext = theOriginalPageContext;
76 this.url = theURL;
77 }
78
79
80
81
82 public static AbstractPageContextWrapper newInstance(PageContext
83 theOriginalPageContext, ServletURL theServletURL)
84 {
85 try
86 {
87 Class clazz = Class.forName(
88 "org.apache.cactus.server.PageContextWrapper");
89 Object[] args = new Object[] {theOriginalPageContext,
90 theServletURL};
91
92 Constructor constructor = clazz.getConstructor(new Class[] {
93 PageContext.class, ServletURL.class });
94
95 return (AbstractPageContextWrapper) constructor.newInstance(args);
96 }
97 catch (Throwable t)
98 {
99 throw new ChainedRuntimeException(
100 "Failed to create PageContextWrapper", t);
101 }
102 }
103
104
105
106
107
108
109
110 public PageContext getOriginalPageContext()
111 {
112 return this.originalPageContext;
113 }
114
115
116
117
118
119
120
121 public ServletRequest getRequest()
122 {
123
124 return AbstractHttpServletRequestWrapper.newInstance(
125 (HttpServletRequest) this.originalPageContext.getRequest(),
126 this.url);
127 }
128
129
130
131
132 public ServletConfig getServletConfig()
133 {
134 return AbstractServletConfigWrapper.newInstance(
135 this.originalPageContext.getServletConfig());
136 }
137
138
139
140
141
142 public ServletContext getServletContext()
143 {
144 return AbstractServletContextWrapper.newInstance(
145 originalPageContext.getServletContext());
146 }
147
148
149
150
151
152
153
154 public Object findAttribute(String theName)
155 {
156 return this.originalPageContext.findAttribute(theName);
157 }
158
159
160
161
162
163 public void forward(String theRelativeURLPath) throws ServletException,
164 IOException
165 {
166 this.originalPageContext.forward(theRelativeURLPath);
167 }
168
169
170
171
172
173 public Object getAttribute(String theName)
174 {
175 return this.originalPageContext.getAttribute(theName);
176 }
177
178
179
180
181
182 public Object getAttribute(String theName, int theScope)
183 {
184 return this.originalPageContext.getAttribute(theName, theScope);
185 }
186
187
188
189
190
191 public Enumeration getAttributeNamesInScope(int theScope)
192 {
193 return this.originalPageContext.getAttributeNamesInScope(theScope);
194 }
195
196
197
198
199
200 public int getAttributesScope(String theName)
201 {
202 return this.originalPageContext.getAttributesScope(theName);
203 }
204
205
206
207
208
209 public Exception getException()
210 {
211 return this.originalPageContext.getException();
212 }
213
214
215
216
217
218 public JspWriter getOut()
219 {
220 return this.originalPageContext.getOut();
221 }
222
223
224
225
226
227 public Object getPage()
228 {
229 return this.originalPageContext.getPage();
230 }
231
232
233
234
235
236 public ServletResponse getResponse()
237 {
238 return this.originalPageContext.getResponse();
239 }
240
241
242
243
244
245 public HttpSession getSession()
246 {
247 return this.originalPageContext.getSession();
248 }
249
250
251
252
253
254 public void handlePageException(Exception theException)
255 throws ServletException, IOException
256 {
257 this.originalPageContext.handlePageException(theException);
258 }
259
260
261
262
263
264 public void include(String theRelativeURLPath) throws ServletException,
265 IOException
266 {
267 this.originalPageContext.include(theRelativeURLPath);
268 }
269
270
271
272
273
274 public void initialize(Servlet theServlet, ServletRequest theRequest,
275 ServletResponse theResponse, String theErrorPageURL,
276 boolean isSessionNeeded, int theBufferSize, boolean isAutoFlush)
277 throws IOException, IllegalStateException, IllegalArgumentException
278 {
279 this.originalPageContext.initialize(theServlet, theRequest,
280 theResponse, theErrorPageURL, isSessionNeeded, theBufferSize,
281 isAutoFlush);
282 }
283
284
285
286
287
288 public JspWriter popBody()
289 {
290 return this.originalPageContext.popBody();
291 }
292
293
294
295
296
297 public BodyContent pushBody()
298 {
299 return this.originalPageContext.pushBody();
300 }
301
302
303
304
305
306 public void release()
307 {
308 this.originalPageContext.release();
309 }
310
311
312
313
314
315 public void removeAttribute(String theName)
316 {
317 this.originalPageContext.removeAttribute(theName);
318 }
319
320
321
322
323
324 public void removeAttribute(String theName, int theScope)
325 {
326 this.originalPageContext.removeAttribute(theName, theScope);
327 }
328
329
330
331
332
333 public void setAttribute(String theName, Object theAttribute)
334 {
335 this.originalPageContext.setAttribute(theName, theAttribute);
336 }
337
338
339
340
341
342 public void setAttribute(String theName, Object theAttribute, int theScope)
343 {
344 this.originalPageContext.setAttribute(theName, theAttribute, theScope);
345 }
346 }