1
|
|
/* Generated by AspectJ version 1.0.5 */
|
2
|
|
package org.apache.cactus.server;
|
3
|
|
import java.io.IOException;
|
4
|
|
import java.util.Enumeration;
|
5
|
|
import javax.servlet.Servlet;
|
6
|
|
import javax.servlet.ServletConfig;
|
7
|
|
import javax.servlet.ServletContext;
|
8
|
|
import javax.servlet.ServletException;
|
9
|
|
import javax.servlet.ServletRequest;
|
10
|
|
import javax.servlet.ServletResponse;
|
11
|
|
import javax.servlet.http.HttpServletRequest;
|
12
|
|
import javax.servlet.http.HttpSession;
|
13
|
|
import javax.servlet.jsp.JspWriter;
|
14
|
|
import javax.servlet.jsp.PageContext;
|
15
|
|
import javax.servlet.jsp.tagext.BodyContent;
|
16
|
|
import org.apache.cactus.ServletURL;
|
17
|
|
|
18
|
|
/**
|
19
|
|
* Abstract wrapper around <code>PageContext</code>. This class provides
|
20
|
|
* a common implementation of the wrapper for the different servlet API.
|
21
|
|
*
|
22
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
23
|
|
*
|
24
|
|
* @version $Id: AbstractPageContextWrapper.java,v 1.2 2002/03/13 20:38:21 vmassol Exp $
|
25
|
|
*/
|
26
|
|
public abstract class AbstractPageContextWrapper extends PageContext {
|
27
|
|
/**
|
28
|
|
* The real page context
|
29
|
|
*/
|
30
|
|
protected PageContext originalPageContext;
|
31
|
|
/**
|
32
|
|
* The URL to simulate
|
33
|
|
*/
|
34
|
|
protected ServletURL url;
|
35
|
|
/**
|
36
|
|
* Construct an <code>PageContext</code> instance that delegates
|
37
|
|
* it's method calls to the page context object passed as parameter and
|
38
|
|
* that uses the URL passed as parameter to simulate a URL from which
|
39
|
|
* the request would come from.
|
40
|
|
*
|
41
|
|
* @param theOriginalPageContext the real page context
|
42
|
|
* @param theURL the URL to simulate or <code>null</code> if none
|
43
|
|
*/
|
44
|
18
|
public AbstractPageContextWrapper(PageContext theOriginalPageContext, ServletURL theURL) {
|
45
|
18
|
super();
|
46
|
18
|
this.originalPageContext = theOriginalPageContext;
|
47
|
18
|
this.url = theURL;
|
48
|
|
}
|
49
|
|
/**
|
50
|
|
* @return the Cactus wrapped servlet request that knows about the
|
51
|
|
* simulated URL
|
52
|
|
*/
|
53
|
0
|
public ServletRequest getRequest() {
|
54
|
0
|
return new HttpServletRequestWrapper((HttpServletRequest)this.originalPageContext.getRequest(
|
55
|
|
), this.url);
|
56
|
|
}
|
57
|
|
|
58
|
|
/**
|
59
|
|
* @return the Cactus wrapped servlet config
|
60
|
|
*/
|
61
|
0
|
public ServletConfig getServletConfig() {
|
62
|
0
|
return new ServletConfigWrapper(this.originalPageContext.getServletConfig());
|
63
|
|
}
|
64
|
|
|
65
|
|
/**
|
66
|
|
* @return the Cactus wrapped servlet context
|
67
|
|
*/
|
68
|
0
|
public ServletContext getServletContext() {
|
69
|
0
|
return new ServletContextWrapper(this.originalPageContext.getServletContext());
|
70
|
|
}
|
71
|
|
|
72
|
|
/**
|
73
|
|
* @see PageContext#findAttribute(String)
|
74
|
|
*/
|
75
|
0
|
public Object findAttribute(String theName) {
|
76
|
0
|
return this.originalPageContext.findAttribute(theName);
|
77
|
|
}
|
78
|
|
|
79
|
|
/**
|
80
|
|
* @see PageContext#forward(String)
|
81
|
|
*/
|
82
|
0
|
public void forward(String theRelativeURLPath) throws ServletException, IOException {
|
83
|
0
|
this.originalPageContext.forward(theRelativeURLPath);
|
84
|
|
}
|
85
|
|
|
86
|
|
/**
|
87
|
|
* @see PageContext#getAttribute(String)
|
88
|
|
*/
|
89
|
51
|
public Object getAttribute(String theName) {
|
90
|
51
|
return this.originalPageContext.getAttribute(theName);
|
91
|
|
}
|
92
|
|
|
93
|
|
/**
|
94
|
|
* @see PageContext#getAttribute(String, int)
|
95
|
|
*/
|
96
|
0
|
public Object getAttribute(String theName, int theScope) {
|
97
|
0
|
return this.originalPageContext.getAttribute(theName, theScope);
|
98
|
|
}
|
99
|
|
|
100
|
|
/**
|
101
|
|
* @see PageContext#getAttributeNamesInScope(int)
|
102
|
|
*/
|
103
|
6
|
public Enumeration getAttributeNamesInScope(int theScope) {
|
104
|
6
|
return this.originalPageContext.getAttributeNamesInScope(theScope);
|
105
|
|
}
|
106
|
|
|
107
|
|
/**
|
108
|
|
* @see PageContext#getAttributesScope(String)
|
109
|
|
*/
|
110
|
0
|
public int getAttributesScope(String theName) {
|
111
|
0
|
return this.originalPageContext.getAttributesScope(theName);
|
112
|
|
}
|
113
|
|
|
114
|
|
/**
|
115
|
|
* @see PageContext#getException()
|
116
|
|
*/
|
117
|
0
|
public Exception getException() {
|
118
|
0
|
return this.originalPageContext.getException();
|
119
|
|
}
|
120
|
|
|
121
|
|
/**
|
122
|
|
* @see PageContext#getOut()
|
123
|
|
*/
|
124
|
9
|
public JspWriter getOut() {
|
125
|
9
|
return this.originalPageContext.getOut();
|
126
|
|
}
|
127
|
|
|
128
|
|
/**
|
129
|
|
* @see PageContext#getPage()
|
130
|
|
*/
|
131
|
0
|
public Object getPage() {
|
132
|
0
|
return this.originalPageContext.getPage();
|
133
|
|
}
|
134
|
|
|
135
|
|
/**
|
136
|
|
* @see PageContext#getResponse()
|
137
|
|
*/
|
138
|
0
|
public ServletResponse getResponse() {
|
139
|
0
|
return this.originalPageContext.getResponse();
|
140
|
|
}
|
141
|
|
|
142
|
|
/**
|
143
|
|
* @see PageContext#getSession()
|
144
|
|
*/
|
145
|
0
|
public HttpSession getSession() {
|
146
|
0
|
return this.originalPageContext.getSession();
|
147
|
|
}
|
148
|
|
|
149
|
|
/**
|
150
|
|
* @see PageContext#handlePageException(Exception)
|
151
|
|
*/
|
152
|
0
|
public void handlePageException(Exception theException) throws ServletException, IOException {
|
153
|
0
|
this.originalPageContext.handlePageException(theException);
|
154
|
|
}
|
155
|
|
|
156
|
|
/**
|
157
|
|
* @see PageContext#include(String)
|
158
|
|
*/
|
159
|
0
|
public void include(String theRelativeURLPath) throws ServletException, IOException {
|
160
|
0
|
this.originalPageContext.include(theRelativeURLPath);
|
161
|
|
}
|
162
|
|
|
163
|
|
/**
|
164
|
|
* @see PageContext#initialize(Servlet, ServletRequest, ServletResponse, String, boolean, int, boolean)
|
165
|
|
*/
|
166
|
0
|
public void initialize(Servlet theServlet, ServletRequest theRequest,
|
167
|
|
ServletResponse theResponse, String theErrorPageURL, boolean isSessionNeeded,
|
168
|
|
int theBufferSize, boolean isAutoFlush) throws IOException, IllegalStateException,
|
169
|
|
IllegalArgumentException {
|
170
|
0
|
this.originalPageContext.initialize(theServlet, theRequest, theResponse, theErrorPageURL,
|
171
|
|
isSessionNeeded, theBufferSize, isAutoFlush);
|
172
|
|
}
|
173
|
|
|
174
|
|
/**
|
175
|
|
* @see PageContext#popBody()
|
176
|
|
*/
|
177
|
3
|
public JspWriter popBody() {
|
178
|
3
|
return this.originalPageContext.popBody();
|
179
|
|
}
|
180
|
|
|
181
|
|
/**
|
182
|
|
* @see PageContext#pushBody()
|
183
|
|
*/
|
184
|
3
|
public BodyContent pushBody() {
|
185
|
3
|
return this.originalPageContext.pushBody();
|
186
|
|
}
|
187
|
|
|
188
|
|
/**
|
189
|
|
* @see PageContext#release()
|
190
|
|
*/
|
191
|
0
|
public void release() {
|
192
|
0
|
this.originalPageContext.release();
|
193
|
|
}
|
194
|
|
|
195
|
|
/**
|
196
|
|
* @see PageContext#removeAttribute(String)
|
197
|
|
*/
|
198
|
0
|
public void removeAttribute(String theName) {
|
199
|
0
|
this.originalPageContext.removeAttribute(theName);
|
200
|
|
}
|
201
|
|
|
202
|
|
/**
|
203
|
|
* @see PageContext#removeAttribute(String, int)
|
204
|
|
*/
|
205
|
0
|
public void removeAttribute(String theName, int theScope) {
|
206
|
0
|
this.originalPageContext.removeAttribute(theName, theScope);
|
207
|
|
}
|
208
|
|
|
209
|
|
/**
|
210
|
|
* @see PageContext#setAttribute(String, Object)
|
211
|
|
*/
|
212
|
3
|
public void setAttribute(String theName, Object theAttribute) {
|
213
|
3
|
this.originalPageContext.setAttribute(theName, theAttribute);
|
214
|
|
}
|
215
|
|
|
216
|
|
/**
|
217
|
|
* @see PageContext#setAttribute(String, Object)
|
218
|
|
*/
|
219
|
0
|
public void setAttribute(String theName, Object theAttribute, int theScope) {
|
220
|
0
|
this.originalPageContext.setAttribute(theName, theAttribute, theScope);
|
221
|
|
}
|
222
|
|
|
223
|
|
}
|