1 package org.andromda.cartridges.jsf.portlet.myfaces.tomahawk.support;
2
3 import java.io.IOException;
4 import java.io.OutputStream;
5 import java.io.PrintWriter;
6 import java.util.Locale;
7 import javax.portlet.PortletURL;
8 import javax.portlet.RenderResponse;
9 import javax.servlet.ServletOutputStream;
10 import javax.servlet.http.Cookie;
11 import javax.servlet.http.HttpServletResponse;
12
13
14
15
16
17
18 public class HttpServletResponseWrapper
19 implements HttpServletResponse, RenderResponse
20 {
21 private final RenderResponse renderResponse;
22
23
24
25
26 public HttpServletResponseWrapper(
27 final RenderResponse renderResponse)
28 {
29 this.renderResponse = renderResponse;
30 }
31
32
33
34
35
36
37 public PrintWriter getWriter() throws IOException
38 {
39 return renderResponse.getWriter();
40 }
41
42
43
44
45
46
47
48
49
50
51
52
53 public void flushBuffer() throws IOException
54 {
55 if (renderResponse != null)
56 {
57 renderResponse.flushBuffer();
58 }
59 }
60
61
62
63
64 public int getBufferSize()
65 {
66 if (renderResponse != null)
67 {
68 return renderResponse.getBufferSize();
69 }
70 return 0;
71 }
72
73
74
75
76 public String getCharacterEncoding()
77 {
78 if (renderResponse != null)
79 {
80 return renderResponse.getCharacterEncoding();
81 }
82 return null;
83 }
84
85
86
87
88 public Locale getLocale()
89 {
90 if (renderResponse != null)
91 {
92 return renderResponse.getLocale();
93 }
94 return null;
95 }
96
97
98
99
100 public ServletOutputStream getOutputStream() throws IOException
101 {
102 if (renderResponse != null)
103 {
104 return new ServletOutputStreamWrapper(renderResponse.getPortletOutputStream());
105 }
106 return null;
107 }
108
109
110
111
112 public boolean isCommitted()
113 {
114 if (renderResponse != null)
115 {
116 return renderResponse.isCommitted();
117 }
118 return false;
119 }
120
121
122
123
124 public void reset()
125 {
126 if (renderResponse != null)
127 {
128 renderResponse.reset();
129 }
130 }
131
132
133
134
135 public void resetBuffer()
136 {
137 if (renderResponse != null)
138 {
139 renderResponse.resetBuffer();
140 }
141
142 }
143
144
145
146
147 public void setBufferSize(final int arg0)
148 {
149 renderResponse.setBufferSize(arg0);
150 }
151
152
153
154
155 public void setContentLength(final int arg0)
156 {
157
158
159 }
160
161
162
163
164 public void setContentType(final String arg0)
165 {
166 if (renderResponse != null)
167 {
168 renderResponse.setContentType(arg0);
169 }
170 }
171
172
173
174
175 public void setLocale(final Locale arg0)
176 {
177
178
179 }
180
181
182
183
184 public void addCookie(final Cookie arg0)
185 {
186
187
188 }
189
190
191
192
193
194 public void addDateHeader(final String arg0, final long arg1)
195 {
196
197 }
198
199
200
201
202
203 public void addHeader(final String arg0, final String arg1)
204 {
205
206 }
207
208
209
210
211
212 public void addIntHeader(final String arg0, final int arg1)
213 {
214
215 }
216
217
218
219
220 public boolean containsHeader(final String arg0)
221 {
222 return false;
223 }
224
225
226
227
228
229 @Deprecated
230 public String encodeRedirectUrl(final String arg0)
231 {
232 return null;
233 }
234
235
236
237
238 public String encodeRedirectURL(final String arg0)
239 {
240 return null;
241 }
242
243
244
245
246
247 @Deprecated
248 public String encodeUrl(final String arg0)
249 {
250 if (renderResponse != null)
251 {
252 return renderResponse.encodeURL(arg0);
253 }
254 return null;
255 }
256
257
258
259
260 public String encodeURL(final String arg0)
261 {
262 return renderResponse.encodeURL(arg0);
263 }
264
265
266
267
268
269 public void sendError(final int arg0, final String arg1) throws IOException
270 {
271
272 }
273
274
275
276
277 public void sendError(final int arg0) throws IOException
278 {
279
280 }
281
282
283
284
285 public void sendRedirect(final String arg0) throws IOException
286 {
287
288 }
289
290
291
292
293
294 public void setDateHeader(final String arg0, final long arg1)
295 {
296
297 }
298
299
300
301
302
303 public void setHeader(final String arg0, final String arg1)
304 {
305
306 }
307
308
309
310
311
312 public void setIntHeader(final String arg0, final int arg1)
313 {
314
315 }
316
317
318
319
320
321
322 @Deprecated
323 public void setStatus(final int arg0, final String arg1)
324 {
325
326 }
327
328
329
330
331 public void setStatus(final int arg0)
332 {
333
334 }
335
336
337
338
339
340 public void addProperty(final String arg0, final String arg1)
341 {
342 renderResponse.addProperty(arg0, arg1);
343 }
344
345
346
347
348
349 public void setProperty(final String arg0, final String arg1)
350 {
351 renderResponse.setProperty(arg0, arg1);
352 }
353
354
355
356
357 public String getContentType()
358 {
359 if (renderResponse != null)
360 {
361 return renderResponse.getContentType();
362 }
363 return null;
364 }
365
366
367
368
369 public void setCharacterEncoding(final String arg0)
370 {
371 }
372
373
374
375
376 public PortletURL createActionURL()
377 {
378 return renderResponse.createActionURL();
379 }
380
381
382
383
384 public PortletURL createRenderURL()
385 {
386 return renderResponse.createRenderURL();
387 }
388
389
390
391
392 public String getNamespace()
393 {
394 return renderResponse.getNamespace();
395 }
396
397
398
399
400 public OutputStream getPortletOutputStream() throws IOException
401 {
402 return renderResponse.getPortletOutputStream();
403 }
404
405
406
407
408 public void setTitle(final String title)
409 {
410 renderResponse.setTitle(title);
411 }
412
413
414
415
416 public RenderResponse getResponse()
417 {
418 return renderResponse;
419 }
420 }