1 | package atg.servlet; |
2 | |
3 | import java.io.IOException; |
4 | import java.io.PrintWriter; |
5 | import java.util.Dictionary; |
6 | import java.util.Enumeration; |
7 | import java.util.Locale; |
8 | |
9 | import javax.servlet.ServletOutputStream; |
10 | import javax.servlet.ServletResponseWrapper; |
11 | import javax.servlet.http.Cookie; |
12 | import javax.servlet.http.HttpServletResponse; |
13 | |
14 | /** |
15 | * A wrapper around DynamoHttpServletResponse to allow for adding test |
16 | * specific methods |
17 | */ |
18 | public class TestingDynamoHttpServletResponse extends DynamoHttpServletResponse { |
19 | |
20 | private DynamoHttpServletResponse mResponse = null; |
21 | public TestingDynamoHttpServletResponse(DynamoHttpServletResponse pResponse) { |
22 | mResponse = pResponse; |
23 | } |
24 | |
25 | // ------------------------------ |
26 | // DynamoHttpServletResponse delegate methods beyond this point |
27 | // |
28 | /** |
29 | * @param pCookie |
30 | * @see atg.servlet.DynamoHttpServletResponse#addCookie(javax.servlet.http.Cookie) |
31 | */ |
32 | public void addCookie(Cookie pCookie) { |
33 | mResponse.addCookie(pCookie); |
34 | } |
35 | /** |
36 | * @param pCookie |
37 | * @see atg.servlet.DynamoHttpServletResponse#addCookieToBuffer(javax.servlet.http.Cookie) |
38 | */ |
39 | public void addCookieToBuffer(Cookie pCookie) { |
40 | mResponse.addCookieToBuffer(pCookie); |
41 | } |
42 | /** |
43 | * @param pName |
44 | * @param pValue |
45 | * @see atg.servlet.DynamoHttpServletResponse#addDateHeader(java.lang.String, long) |
46 | */ |
47 | public void addDateHeader(String pName, long pValue) { |
48 | mResponse.addDateHeader(pName, pValue); |
49 | } |
50 | /** |
51 | * @param pName |
52 | * @param pValue |
53 | * @see atg.servlet.DynamoHttpServletResponse#addHeader(java.lang.String, java.lang.String) |
54 | */ |
55 | public void addHeader(String pName, String pValue) { |
56 | mResponse.addHeader(pName, pValue); |
57 | } |
58 | /** |
59 | * @param pName |
60 | * @param pValue |
61 | * @see atg.servlet.DynamoHttpServletResponse#addIntHeader(java.lang.String, int) |
62 | */ |
63 | public void addIntHeader(String pName, int pValue) { |
64 | mResponse.addIntHeader(pName, pValue); |
65 | } |
66 | /** |
67 | * @param pName |
68 | * @return |
69 | * @see atg.servlet.DynamoHttpServletResponse#containsHeader(java.lang.String) |
70 | */ |
71 | public boolean containsHeader(String pName) { |
72 | return mResponse.containsHeader(pName); |
73 | } |
74 | /** |
75 | * @param pUrl |
76 | * @return |
77 | * @deprecated |
78 | * @see atg.servlet.DynamoHttpServletResponse#encodeRedirectUrl(java.lang.String) |
79 | */ |
80 | public String encodeRedirectUrl(String pUrl) { |
81 | return mResponse.encodeRedirectUrl(pUrl); |
82 | } |
83 | /** |
84 | * @param pUrl |
85 | * @return |
86 | * @see atg.servlet.DynamoHttpServletResponse#encodeRedirectURL(java.lang.String) |
87 | */ |
88 | public String encodeRedirectURL(String pUrl) { |
89 | return mResponse.encodeRedirectURL(pUrl); |
90 | } |
91 | /** |
92 | * @param pUrl |
93 | * @return |
94 | * @deprecated |
95 | * @see atg.servlet.DynamoHttpServletResponse#encodeUrl(java.lang.String) |
96 | */ |
97 | public String encodeUrl(String pUrl) { |
98 | return mResponse.encodeUrl(pUrl); |
99 | } |
100 | /** |
101 | * @param pUrl |
102 | * @return |
103 | * @see atg.servlet.DynamoHttpServletResponse#encodeURL(java.lang.String) |
104 | */ |
105 | public String encodeURL(String pUrl) { |
106 | return mResponse.encodeURL(pUrl); |
107 | } |
108 | /** |
109 | * @param pObj |
110 | * @return |
111 | * @see java.lang.Object#equals(java.lang.Object) |
112 | */ |
113 | public boolean equals(Object pObj) { |
114 | return mResponse.equals(pObj); |
115 | } |
116 | /** |
117 | * @throws IOException |
118 | * @see atg.servlet.DynamoHttpServletResponse#flushBuffer() |
119 | */ |
120 | public void flushBuffer() throws IOException { |
121 | mResponse.flushBuffer(); |
122 | } |
123 | /** |
124 | * @return |
125 | * @see atg.servlet.DynamoHttpServletResponse#getBufferSize() |
126 | */ |
127 | public int getBufferSize() { |
128 | return mResponse.getBufferSize(); |
129 | } |
130 | /** |
131 | * @return |
132 | * @see atg.servlet.DynamoHttpServletResponse#getCharacterEncoding() |
133 | */ |
134 | public String getCharacterEncoding() { |
135 | return mResponse.getCharacterEncoding(); |
136 | } |
137 | /** |
138 | * @return |
139 | * @see atg.servlet.DynamoHttpServletResponse#getContentType() |
140 | */ |
141 | public String getContentType() { |
142 | return mResponse.getContentType(); |
143 | } |
144 | /** |
145 | * @return |
146 | * @see atg.servlet.DynamoHttpServletResponse#getContentTypeSet() |
147 | */ |
148 | public boolean getContentTypeSet() { |
149 | return mResponse.getContentTypeSet(); |
150 | } |
151 | /** |
152 | * @return |
153 | * @see atg.servlet.DynamoHttpServletResponse#getDoExitTracking() |
154 | */ |
155 | public boolean getDoExitTracking() { |
156 | return mResponse.getDoExitTracking(); |
157 | } |
158 | /** |
159 | * @return |
160 | * @see atg.servlet.DynamoHttpServletResponse#getHeaders() |
161 | */ |
162 | public Dictionary getHeaders() { |
163 | return mResponse.getHeaders(); |
164 | } |
165 | /** |
166 | * @param pHeaderName |
167 | * @return |
168 | * @see atg.servlet.DynamoHttpServletResponse#getHeaders(java.lang.String) |
169 | */ |
170 | public Enumeration getHeaders(String pHeaderName) { |
171 | return mResponse.getHeaders(pHeaderName); |
172 | } |
173 | /** |
174 | * @return |
175 | * @see atg.servlet.DynamoHttpServletResponse#getLocale() |
176 | */ |
177 | public Locale getLocale() { |
178 | return mResponse.getLocale(); |
179 | } |
180 | /** |
181 | * @return |
182 | * @see atg.servlet.DynamoHttpServletResponse#getLocaleToCharsetMapper() |
183 | */ |
184 | public LocaleToCharsetMapper getLocaleToCharsetMapper() { |
185 | return mResponse.getLocaleToCharsetMapper(); |
186 | } |
187 | /** |
188 | * @return |
189 | * @throws IOException |
190 | * @see atg.servlet.DynamoHttpServletResponse#getOutputStream() |
191 | */ |
192 | public ByteArrayServletOutputStream getOutputStream() throws IOException { |
193 | return (ByteArrayServletOutputStream) mResponse.getOutputStream(); |
194 | } |
195 | /** |
196 | * @return |
197 | * @see atg.servlet.DynamoHttpServletResponse#getResponse() |
198 | */ |
199 | public HttpServletResponse getResponse() { |
200 | return mResponse.getResponse(); |
201 | } |
202 | /** |
203 | * @return |
204 | * @see atg.servlet.DynamoHttpServletResponse#getStatus() |
205 | */ |
206 | public int getStatus() { |
207 | return mResponse.getStatus(); |
208 | } |
209 | /** |
210 | * @return |
211 | * @see atg.servlet.DynamoHttpServletResponse#getWrapper() |
212 | */ |
213 | public ServletResponseWrapper getWrapper() { |
214 | return mResponse.getWrapper(); |
215 | } |
216 | /** |
217 | * @return |
218 | * @throws IOException |
219 | * @see atg.servlet.DynamoHttpServletResponse#getWriter() |
220 | */ |
221 | public PrintWriter getWriter() throws IOException { |
222 | return mResponse.getWriter(); |
223 | } |
224 | /** |
225 | * @return |
226 | * @see java.lang.Object#hashCode() |
227 | */ |
228 | public int hashCode() { |
229 | return mResponse.hashCode(); |
230 | } |
231 | /** |
232 | * @return |
233 | * @see atg.servlet.DynamoHttpServletResponse#isCommitted() |
234 | */ |
235 | public boolean isCommitted() { |
236 | return mResponse.isCommitted(); |
237 | } |
238 | /** |
239 | * @return |
240 | * @see atg.servlet.DynamoHttpServletResponse#isResponseComplete() |
241 | */ |
242 | public boolean isResponseComplete() { |
243 | return mResponse.isResponseComplete(); |
244 | } |
245 | /** |
246 | * @return |
247 | * @see atg.servlet.DynamoHttpServletResponse#isWriterUsed() |
248 | */ |
249 | public boolean isWriterUsed() { |
250 | return mResponse.isWriterUsed(); |
251 | } |
252 | /** |
253 | * |
254 | * @see atg.servlet.DynamoHttpServletResponse#reset() |
255 | */ |
256 | public void reset() { |
257 | mResponse.reset(); |
258 | } |
259 | /** |
260 | * |
261 | * @see atg.servlet.DynamoHttpServletResponse#resetBuffer() |
262 | */ |
263 | public void resetBuffer() { |
264 | mResponse.resetBuffer(); |
265 | } |
266 | /** |
267 | * @param pCode |
268 | * @param pMessage |
269 | * @throws IOException |
270 | * @see atg.servlet.DynamoHttpServletResponse#sendError(int, java.lang.String) |
271 | */ |
272 | public void sendError(int pCode, String pMessage) throws IOException { |
273 | mResponse.sendError(pCode, pMessage); |
274 | } |
275 | /** |
276 | * @param pCode |
277 | * @throws IOException |
278 | * @see atg.servlet.DynamoHttpServletResponse#sendError(int) |
279 | */ |
280 | public void sendError(int pCode) throws IOException { |
281 | mResponse.sendError(pCode); |
282 | } |
283 | /** |
284 | * @param pLocation |
285 | * @param pRequest |
286 | * @throws IOException |
287 | * @see atg.servlet.DynamoHttpServletResponse#sendLocalRedirect(java.lang.String, atg.servlet.DynamoHttpServletRequest) |
288 | */ |
289 | public void sendLocalRedirect(String pLocation, |
290 | DynamoHttpServletRequest pRequest) throws IOException { |
291 | mResponse.sendLocalRedirect(pLocation, pRequest); |
292 | } |
293 | /** |
294 | * @param pLocation |
295 | * @throws IOException |
296 | * @see atg.servlet.DynamoHttpServletResponse#sendRedirect(java.lang.String) |
297 | */ |
298 | public void sendRedirect(String pLocation) throws IOException { |
299 | mResponse.sendRedirect(pLocation); |
300 | } |
301 | /** |
302 | * @param pBufferSize |
303 | * @see atg.servlet.DynamoHttpServletResponse#setBufferSize(int) |
304 | */ |
305 | public void setBufferSize(int pBufferSize) { |
306 | mResponse.setBufferSize(pBufferSize); |
307 | } |
308 | /** |
309 | * @param pCharset |
310 | * @see atg.servlet.DynamoHttpServletResponse#setCharacterEncoding(java.lang.String) |
311 | */ |
312 | public void setCharacterEncoding(String pCharset) { |
313 | mResponse.setCharacterEncoding(pCharset); |
314 | } |
315 | /** |
316 | * @param pLength |
317 | * @see atg.servlet.DynamoHttpServletResponse#setContentLength(int) |
318 | */ |
319 | public void setContentLength(int pLength) { |
320 | mResponse.setContentLength(pLength); |
321 | } |
322 | /** |
323 | * @param pContentType |
324 | * @see atg.servlet.DynamoHttpServletResponse#setContentType(java.lang.String) |
325 | */ |
326 | public void setContentType(String pContentType) { |
327 | mResponse.setContentType(pContentType); |
328 | } |
329 | /** |
330 | * @param pContentTypeSet |
331 | * @see atg.servlet.DynamoHttpServletResponse#setContentTypeSet(boolean) |
332 | */ |
333 | public void setContentTypeSet(boolean pContentTypeSet) { |
334 | mResponse.setContentTypeSet(pContentTypeSet); |
335 | } |
336 | /** |
337 | * @param pName |
338 | * @param pValue |
339 | * @see atg.servlet.DynamoHttpServletResponse#setDateHeader(java.lang.String, long) |
340 | */ |
341 | public void setDateHeader(String pName, long pValue) { |
342 | mResponse.setDateHeader(pName, pValue); |
343 | } |
344 | /** |
345 | * @param pDoExitTracking |
346 | * @see atg.servlet.DynamoHttpServletResponse#setDoExitTracking(boolean) |
347 | */ |
348 | public void setDoExitTracking(boolean pDoExitTracking) { |
349 | mResponse.setDoExitTracking(pDoExitTracking); |
350 | } |
351 | /** |
352 | * @param pName |
353 | * @param pValue |
354 | * @see atg.servlet.DynamoHttpServletResponse#setHeader(java.lang.String, java.lang.String) |
355 | */ |
356 | public void setHeader(String pName, String pValue) { |
357 | mResponse.setHeader(pName, pValue); |
358 | } |
359 | /** |
360 | * @param pName |
361 | * @param pValue |
362 | * @see atg.servlet.DynamoHttpServletResponse#setIntHeader(java.lang.String, int) |
363 | */ |
364 | public void setIntHeader(String pName, int pValue) { |
365 | mResponse.setIntHeader(pName, pValue); |
366 | } |
367 | /** |
368 | * @param pLocale |
369 | * @see atg.servlet.DynamoHttpServletResponse#setLocale(java.util.Locale) |
370 | */ |
371 | public void setLocale(Locale pLocale) { |
372 | mResponse.setLocale(pLocale); |
373 | } |
374 | /** |
375 | * @param pMapper |
376 | * @see atg.servlet.DynamoHttpServletResponse#setLocaleToCharsetMapper(atg.servlet.LocaleToCharsetMapper) |
377 | */ |
378 | public void setLocaleToCharsetMapper(LocaleToCharsetMapper pMapper) { |
379 | mResponse.setLocaleToCharsetMapper(pMapper); |
380 | } |
381 | /** |
382 | * @param pOutputStream |
383 | * @see atg.servlet.DynamoHttpServletResponse#setOutputStream(javax.servlet.ServletOutputStream) |
384 | */ |
385 | public void setOutputStream(ServletOutputStream pOutputStream) { |
386 | mResponse.setOutputStream(pOutputStream); |
387 | } |
388 | /** |
389 | * @param pRequest |
390 | * @see atg.servlet.DynamoHttpServletResponse#setRequest(atg.servlet.DynamoHttpServletRequest) |
391 | */ |
392 | public void setRequest(DynamoHttpServletRequest pRequest) { |
393 | mResponse.setRequest(pRequest); |
394 | } |
395 | /** |
396 | * @param pResponse |
397 | * @see atg.servlet.DynamoHttpServletResponse#setResponse(javax.servlet.http.HttpServletResponse) |
398 | */ |
399 | public void setResponse(HttpServletResponse pResponse) { |
400 | mResponse.setResponse(pResponse); |
401 | } |
402 | /** |
403 | * @param pCode |
404 | * @param pMessage |
405 | * @deprecated |
406 | * @see atg.servlet.DynamoHttpServletResponse#setStatus(int, java.lang.String) |
407 | */ |
408 | public void setStatus(int pCode, String pMessage) { |
409 | mResponse.setStatus(pCode, pMessage); |
410 | } |
411 | /** |
412 | * @param pCode |
413 | * @see atg.servlet.DynamoHttpServletResponse#setStatus(int) |
414 | */ |
415 | public void setStatus(int pCode) { |
416 | mResponse.setStatus(pCode); |
417 | } |
418 | /** |
419 | * @param pStrict |
420 | * @return |
421 | * @see atg.servlet.DynamoHttpServletResponse#setStrictOutputAccess(boolean) |
422 | */ |
423 | public boolean setStrictOutputAccess(boolean pStrict) { |
424 | return mResponse.setStrictOutputAccess(pStrict); |
425 | } |
426 | /** |
427 | * @param pWrapper |
428 | * @see atg.servlet.DynamoHttpServletResponse#setWrapper(javax.servlet.ServletResponseWrapper) |
429 | */ |
430 | public void setWrapper(ServletResponseWrapper pWrapper) { |
431 | mResponse.setWrapper(pWrapper); |
432 | } |
433 | /** |
434 | * @param pWriter |
435 | * @see atg.servlet.DynamoHttpServletResponse#setWriter(java.io.PrintWriter) |
436 | */ |
437 | public void setWriter(PrintWriter pWriter) { |
438 | mResponse.setWriter(pWriter); |
439 | } |
440 | /** |
441 | * @return |
442 | * @see java.lang.Object#toString() |
443 | */ |
444 | public String toString() { |
445 | return mResponse.toString(); |
446 | } |
447 | } |