01: package com.sun.portal.providers.portletwindow;
02:
03: import javax.servlet.ServletOutputStream;
04: import javax.servlet.http.HttpServletResponse;
05: import javax.servlet.http.HttpServletResponseWrapper;
06: import java.io.IOException;
07: import java.io.PrintWriter;
08:
09: /**
10: * This class is used as a wrapper over HttpServletResponse.
11: * To avoid any write operation to the original HttpServletResponse
12: * this wrapper will override methods which involves writing to
13: * response.
14: */
15: public class PAEResponseWrapper extends HttpServletResponseWrapper {
16: public PAEResponseWrapper(HttpServletResponse res) {
17: super (res);
18: }
19:
20: public ServletOutputStream getOutputStream()
21: throws java.io.IOException {
22: return new PSServletOutputStream();
23: }
24:
25: public java.io.PrintWriter getWriter() throws java.io.IOException {
26: return new PrintWriter(new PSServletOutputStream());
27: }
28:
29: public void sendError(int sc) throws java.io.IOException {
30: //Do nothing ...
31: }
32:
33: public void setStatus(int sc) {
34: //Do nothing ...
35: }
36:
37: public void setStatus(int sc, java.lang.String sm) {
38: //Do nothing ...
39: }
40:
41: //Implementation to avoid writing to actual HttpServletResponse
42: class PSServletOutputStream extends ServletOutputStream {
43: public PSServletOutputStream() {
44: //Do nothing ...
45: }
46:
47: public void write(int b) throws IOException {
48: //Nothing to be done ...
49: }
50: }
51: }
|