1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.pluginwizard.web;
35
36 import java.io.IOException;
37 import java.io.PrintWriter;
38 import java.util.ArrayList;
39 import java.util.Collection;
40 import java.util.List;
41
42 import java.util.Locale;
43
44 import javax.servlet.ServletOutputStream;
45 import javax.servlet.http.Cookie;
46 import javax.servlet.http.HttpServletResponse;
47
48
49
50
51
52 public class MokeHttpServletResponse implements HttpServletResponse
53 {
54
55 private int _status;
56 private long contentLength;
57
58 @Override
59 public void addCookie( Cookie cookie )
60 {
61 }
62
63 @Override
64 public boolean containsHeader( String string )
65 {
66 return true;
67 }
68
69 @Override
70 public String encodeURL( String string )
71 {
72 return string;
73 }
74
75 @Override
76 public String encodeRedirectURL( String string )
77 {
78 return string;
79 }
80
81 @Override
82 public String encodeUrl( String string )
83 {
84 return string;
85 }
86
87 @Override
88 public String encodeRedirectUrl( String string )
89 {
90 return string;
91 }
92
93 @Override
94 public void sendError( int i, String string ) throws IOException
95 {
96 }
97
98 @Override
99 public void sendError( int i ) throws IOException
100 {
101 }
102
103 @Override
104 public void sendRedirect( String string ) throws IOException
105 {
106 }
107
108 @Override
109 public void setDateHeader( String string, long l )
110 {
111 }
112
113 @Override
114 public void addDateHeader( String string, long l )
115 {
116 }
117
118 @Override
119 public void setHeader( String string, String string1 )
120 {
121 }
122
123 @Override
124 public void addHeader( String string, String string1 )
125 {
126 }
127
128 @Override
129 public void setIntHeader( String string, int i )
130 {
131 }
132
133 @Override
134 public void addIntHeader( String string, int i )
135 {
136 }
137
138 @Override
139 public void setStatus( int status )
140 {
141 if ( !this.isCommitted( ) )
142 {
143 this._status = status;
144 }
145 }
146
147 @Override
148 public void setStatus( int status, String string )
149 {
150 setStatus( status );
151 }
152
153 @Override
154 public String getCharacterEncoding( )
155 {
156 return "UTF-8";
157 }
158
159 @Override
160 public String getContentType( )
161 {
162 return "text";
163 }
164
165 @Override
166 public ServletOutputStream getOutputStream( ) throws IOException
167 {
168 return null;
169 }
170
171 @Override
172 public PrintWriter getWriter( ) throws IOException
173 {
174 throw new UnsupportedOperationException( "Not supported yet." );
175 }
176
177 @Override
178 public void setCharacterEncoding( String string )
179 {
180 }
181
182 @Override
183 public void setContentLength( int i )
184 {
185 }
186
187 @Override
188 public void setContentType( String string )
189 {
190 }
191
192 @Override
193 public void setBufferSize( int i )
194 {
195 }
196
197 @Override
198 public int getBufferSize( )
199 {
200 return 1024;
201 }
202
203 @Override
204 public void flushBuffer( ) throws IOException
205 {
206 }
207
208 @Override
209 public void resetBuffer( )
210 {
211 }
212
213 @Override
214 public boolean isCommitted( )
215 {
216 return true;
217 }
218
219 @Override
220 public void reset( )
221 {
222 }
223
224 @Override
225 public void setLocale( Locale locale )
226 {
227 }
228
229 @Override
230 public Locale getLocale( )
231 {
232 return Locale.getDefault( );
233 }
234
235 @Override
236 public int getStatus( )
237 {
238 return 200;
239 }
240
241 @Override
242 public String getHeader( String string )
243 {
244 return "mock";
245 }
246
247 @Override
248 public Collection<String> getHeaders( String string )
249 {
250 List<String> listHeaders = new ArrayList<String>( );
251 listHeaders.add( "mock" );
252
253 return listHeaders;
254 }
255
256 @Override
257 public Collection<String> getHeaderNames( )
258 {
259 List<String> listHeaders = new ArrayList<String>( );
260 listHeaders.add( "mock" );
261
262 return listHeaders;
263 }
264
265 @Override
266 public void setContentLengthLong( long contentLength )
267 {
268 this.contentLength = contentLength;
269
270 }
271
272 }