1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.portletbridge.mock;
17  
18  import java.io.ByteArrayOutputStream;
19  import java.io.IOException;
20  import java.io.PrintWriter;
21  import java.util.Locale;
22  
23  import javax.servlet.ServletOutputStream;
24  import javax.servlet.http.Cookie;
25  import javax.servlet.http.HttpServletResponse;
26  
27  /***
28   * @author JMcCrindle
29   */
30  public class MockHttpServletResponse implements HttpServletResponse {
31  
32      private ByteArrayOutputStream responseOutputStream = new ByteArrayOutputStream();
33      
34      /***
35       * 
36       */
37      public MockHttpServletResponse() {
38          super();
39      }
40  
41      /* (non-Javadoc)
42       * @see javax.servlet.http.HttpServletResponse#addCookie(javax.servlet.http.Cookie)
43       */
44      public void addCookie(Cookie arg0) {
45          // TODO Auto-generated method stub
46  
47      }
48  
49      /* (non-Javadoc)
50       * @see javax.servlet.http.HttpServletResponse#containsHeader(java.lang.String)
51       */
52      public boolean containsHeader(String arg0) {
53          // TODO Auto-generated method stub
54          return false;
55      }
56  
57      /* (non-Javadoc)
58       * @see javax.servlet.http.HttpServletResponse#encodeURL(java.lang.String)
59       */
60      public String encodeURL(String arg0) {
61          // TODO Auto-generated method stub
62          return null;
63      }
64  
65      /* (non-Javadoc)
66       * @see javax.servlet.http.HttpServletResponse#encodeRedirectURL(java.lang.String)
67       */
68      public String encodeRedirectURL(String arg0) {
69          // TODO Auto-generated method stub
70          return null;
71      }
72  
73      /* (non-Javadoc)
74       * @see javax.servlet.http.HttpServletResponse#encodeUrl(java.lang.String)
75       */
76      public String encodeUrl(String arg0) {
77          // TODO Auto-generated method stub
78          return null;
79      }
80  
81      /* (non-Javadoc)
82       * @see javax.servlet.http.HttpServletResponse#encodeRedirectUrl(java.lang.String)
83       */
84      public String encodeRedirectUrl(String arg0) {
85          // TODO Auto-generated method stub
86          return null;
87      }
88  
89      /* (non-Javadoc)
90       * @see javax.servlet.http.HttpServletResponse#sendError(int, java.lang.String)
91       */
92      public void sendError(int arg0, String arg1) throws IOException {
93          // TODO Auto-generated method stub
94  
95      }
96  
97      /* (non-Javadoc)
98       * @see javax.servlet.http.HttpServletResponse#sendError(int)
99       */
100     public void sendError(int arg0) throws IOException {
101         // TODO Auto-generated method stub
102 
103     }
104 
105     /* (non-Javadoc)
106      * @see javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)
107      */
108     public void sendRedirect(String arg0) throws IOException {
109         // TODO Auto-generated method stub
110 
111     }
112 
113     /* (non-Javadoc)
114      * @see javax.servlet.http.HttpServletResponse#setDateHeader(java.lang.String, long)
115      */
116     public void setDateHeader(String arg0, long arg1) {
117         // TODO Auto-generated method stub
118 
119     }
120 
121     /* (non-Javadoc)
122      * @see javax.servlet.http.HttpServletResponse#addDateHeader(java.lang.String, long)
123      */
124     public void addDateHeader(String arg0, long arg1) {
125         // TODO Auto-generated method stub
126 
127     }
128 
129     /* (non-Javadoc)
130      * @see javax.servlet.http.HttpServletResponse#setHeader(java.lang.String, java.lang.String)
131      */
132     public void setHeader(String arg0, String arg1) {
133         // TODO Auto-generated method stub
134 
135     }
136 
137     /* (non-Javadoc)
138      * @see javax.servlet.http.HttpServletResponse#addHeader(java.lang.String, java.lang.String)
139      */
140     public void addHeader(String arg0, String arg1) {
141         // TODO Auto-generated method stub
142 
143     }
144 
145     /* (non-Javadoc)
146      * @see javax.servlet.http.HttpServletResponse#setIntHeader(java.lang.String, int)
147      */
148     public void setIntHeader(String arg0, int arg1) {
149         // TODO Auto-generated method stub
150 
151     }
152 
153     /* (non-Javadoc)
154      * @see javax.servlet.http.HttpServletResponse#addIntHeader(java.lang.String, int)
155      */
156     public void addIntHeader(String arg0, int arg1) {
157         // TODO Auto-generated method stub
158 
159     }
160 
161     /* (non-Javadoc)
162      * @see javax.servlet.http.HttpServletResponse#setStatus(int)
163      */
164     public void setStatus(int arg0) {
165         // TODO Auto-generated method stub
166 
167     }
168 
169     /* (non-Javadoc)
170      * @see javax.servlet.http.HttpServletResponse#setStatus(int, java.lang.String)
171      */
172     public void setStatus(int arg0, String arg1) {
173         // TODO Auto-generated method stub
174 
175     }
176 
177     /* (non-Javadoc)
178      * @see javax.servlet.ServletResponse#getCharacterEncoding()
179      */
180     public String getCharacterEncoding() {
181         // TODO Auto-generated method stub
182         return null;
183     }
184 
185     /* (non-Javadoc)
186      * @see javax.servlet.ServletResponse#getOutputStream()
187      */
188     public ServletOutputStream getOutputStream() throws IOException {
189         return new ServletOutputStream() {
190             public void write(int b) throws IOException {
191                 responseOutputStream.write(b);
192             }
193         };
194     }
195 
196     /* (non-Javadoc)
197      * @see javax.servlet.ServletResponse#getWriter()
198      */
199     public PrintWriter getWriter() throws IOException {
200         // TODO Auto-generated method stub
201         return null;
202     }
203 
204     /* (non-Javadoc)
205      * @see javax.servlet.ServletResponse#setContentLength(int)
206      */
207     public void setContentLength(int arg0) {
208         // TODO Auto-generated method stub
209 
210     }
211 
212     /* (non-Javadoc)
213      * @see javax.servlet.ServletResponse#setContentType(java.lang.String)
214      */
215     public void setContentType(String arg0) {
216         // TODO Auto-generated method stub
217 
218     }
219 
220     /* (non-Javadoc)
221      * @see javax.servlet.ServletResponse#setBufferSize(int)
222      */
223     public void setBufferSize(int arg0) {
224         // TODO Auto-generated method stub
225 
226     }
227 
228     /* (non-Javadoc)
229      * @see javax.servlet.ServletResponse#getBufferSize()
230      */
231     public int getBufferSize() {
232         // TODO Auto-generated method stub
233         return 0;
234     }
235 
236     /* (non-Javadoc)
237      * @see javax.servlet.ServletResponse#flushBuffer()
238      */
239     public void flushBuffer() throws IOException {
240         // TODO Auto-generated method stub
241 
242     }
243 
244     /* (non-Javadoc)
245      * @see javax.servlet.ServletResponse#resetBuffer()
246      */
247     public void resetBuffer() {
248         // TODO Auto-generated method stub
249 
250     }
251 
252     /* (non-Javadoc)
253      * @see javax.servlet.ServletResponse#isCommitted()
254      */
255     public boolean isCommitted() {
256         // TODO Auto-generated method stub
257         return false;
258     }
259 
260     /* (non-Javadoc)
261      * @see javax.servlet.ServletResponse#reset()
262      */
263     public void reset() {
264         // TODO Auto-generated method stub
265 
266     }
267 
268     /* (non-Javadoc)
269      * @see javax.servlet.ServletResponse#setLocale(java.util.Locale)
270      */
271     public void setLocale(Locale arg0) {
272         // TODO Auto-generated method stub
273 
274     }
275 
276     /* (non-Javadoc)
277      * @see javax.servlet.ServletResponse#getLocale()
278      */
279     public Locale getLocale() {
280         // TODO Auto-generated method stub
281         return null;
282     }
283 
284 }