1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.context.servlet; |
20 | |
|
21 | |
import java.io.IOException; |
22 | |
import java.io.OutputStream; |
23 | |
import java.io.UnsupportedEncodingException; |
24 | |
import java.io.Writer; |
25 | |
import java.security.Principal; |
26 | |
import java.util.Iterator; |
27 | |
import java.util.List; |
28 | |
import java.util.Locale; |
29 | |
import java.util.Map; |
30 | |
|
31 | |
import javax.faces.context.Flash; |
32 | |
import javax.servlet.ServletContext; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
public class StartupServletExternalContextImpl extends ServletExternalContextImplBase |
44 | |
{ |
45 | |
public static final String EXCEPTION_TEXT = "This method is not supported during "; |
46 | |
|
47 | |
private boolean _startup; |
48 | |
|
49 | |
public StartupServletExternalContextImpl(final ServletContext servletContext, |
50 | |
boolean startup) |
51 | |
{ |
52 | 0 | super(servletContext); |
53 | 0 | _startup = startup; |
54 | 0 | } |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
@Override |
67 | |
public String encodeActionURL(String url) |
68 | |
{ |
69 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
70 | |
} |
71 | |
|
72 | |
@Override |
73 | |
public String encodeNamespace(String name) |
74 | |
{ |
75 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
76 | |
} |
77 | |
|
78 | |
@Override |
79 | |
public String encodeResourceURL(String url) |
80 | |
{ |
81 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
82 | |
} |
83 | |
|
84 | |
@Override |
85 | |
public String getAuthType() |
86 | |
{ |
87 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
88 | |
} |
89 | |
|
90 | |
@Override |
91 | |
public String getRemoteUser() |
92 | |
{ |
93 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
94 | |
} |
95 | |
|
96 | |
@Override |
97 | |
public Object getRequest() |
98 | |
{ |
99 | 0 | return null; |
100 | |
|
101 | |
} |
102 | |
|
103 | |
@Override |
104 | |
public String getRequestContextPath() |
105 | |
{ |
106 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
107 | |
} |
108 | |
|
109 | |
@Override |
110 | |
public Map<String, Object> getRequestCookieMap() |
111 | |
{ |
112 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
113 | |
} |
114 | |
|
115 | |
@Override |
116 | |
public Map<String, String> getRequestHeaderMap() |
117 | |
{ |
118 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
119 | |
} |
120 | |
|
121 | |
@Override |
122 | |
public Map<String, String[]> getRequestHeaderValuesMap() |
123 | |
{ |
124 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
125 | |
} |
126 | |
|
127 | |
@Override |
128 | |
public Locale getRequestLocale() |
129 | |
{ |
130 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
131 | |
} |
132 | |
|
133 | |
@Override |
134 | |
public Iterator<Locale> getRequestLocales() |
135 | |
{ |
136 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
137 | |
} |
138 | |
|
139 | |
@Override |
140 | |
public Map<String, Object> getRequestMap() |
141 | |
{ |
142 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
143 | |
} |
144 | |
|
145 | |
@Override |
146 | |
public Map<String, String> getRequestParameterMap() |
147 | |
{ |
148 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
149 | |
} |
150 | |
|
151 | |
@Override |
152 | |
public Iterator<String> getRequestParameterNames() |
153 | |
{ |
154 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
155 | |
} |
156 | |
|
157 | |
@Override |
158 | |
public Map<String, String[]> getRequestParameterValuesMap() |
159 | |
{ |
160 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
161 | |
} |
162 | |
|
163 | |
@Override |
164 | |
public String getRequestPathInfo() |
165 | |
{ |
166 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
167 | |
} |
168 | |
|
169 | |
@Override |
170 | |
public String getRequestServletPath() |
171 | |
{ |
172 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
173 | |
} |
174 | |
|
175 | |
@Override |
176 | |
public Object getResponse() |
177 | |
{ |
178 | 0 | return null; |
179 | |
|
180 | |
} |
181 | |
|
182 | |
@Override |
183 | |
public Object getSession(boolean create) |
184 | |
{ |
185 | 0 | if (create) |
186 | |
{ |
187 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
188 | |
} |
189 | 0 | return null; |
190 | |
} |
191 | |
|
192 | |
@Override |
193 | |
public String getSessionId(boolean create) |
194 | |
{ |
195 | 0 | if (create) |
196 | |
{ |
197 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
198 | |
} |
199 | 0 | return null; |
200 | |
} |
201 | |
|
202 | |
@Override |
203 | |
public Map<String, Object> getSessionMap() |
204 | |
{ |
205 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
206 | |
} |
207 | |
|
208 | |
@Override |
209 | |
public Principal getUserPrincipal() |
210 | |
{ |
211 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
212 | |
} |
213 | |
|
214 | |
@Override |
215 | |
public boolean isUserInRole(String role) |
216 | |
{ |
217 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
218 | |
} |
219 | |
|
220 | |
@Override |
221 | |
public String encodeBookmarkableURL(String baseUrl, |
222 | |
Map<String, List<String>> parameters) |
223 | |
{ |
224 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
225 | |
} |
226 | |
|
227 | |
@Override |
228 | |
public String encodePartialActionURL(String url) |
229 | |
{ |
230 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
231 | |
} |
232 | |
|
233 | |
@Override |
234 | |
public String encodeRedirectURL(String baseUrl, |
235 | |
Map<String, List<String>> parameters) |
236 | |
{ |
237 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
238 | |
} |
239 | |
|
240 | |
@Override |
241 | |
public String getRequestCharacterEncoding() |
242 | |
{ |
243 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
244 | |
} |
245 | |
|
246 | |
@Override |
247 | |
public int getRequestContentLength() |
248 | |
{ |
249 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
250 | |
} |
251 | |
|
252 | |
@Override |
253 | |
public String getRequestContentType() |
254 | |
{ |
255 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
256 | |
} |
257 | |
|
258 | |
@Override |
259 | |
public String getRequestScheme() |
260 | |
{ |
261 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
262 | |
} |
263 | |
|
264 | |
@Override |
265 | |
public String getRequestServerName() |
266 | |
{ |
267 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
268 | |
} |
269 | |
|
270 | |
@Override |
271 | |
public int getRequestServerPort() |
272 | |
{ |
273 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
274 | |
} |
275 | |
|
276 | |
@Override |
277 | |
public int getResponseBufferSize() |
278 | |
{ |
279 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
280 | |
} |
281 | |
|
282 | |
@Override |
283 | |
public String getResponseCharacterEncoding() |
284 | |
{ |
285 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
286 | |
} |
287 | |
|
288 | |
@Override |
289 | |
public String getResponseContentType() |
290 | |
{ |
291 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
292 | |
} |
293 | |
|
294 | |
@Override |
295 | |
public void invalidateSession() |
296 | |
{ |
297 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
298 | |
} |
299 | |
|
300 | |
@Override |
301 | |
public boolean isResponseCommitted() |
302 | |
{ |
303 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
304 | |
} |
305 | |
|
306 | |
@Override |
307 | |
public void setRequest(Object request) |
308 | |
{ |
309 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
310 | |
} |
311 | |
|
312 | |
@Override |
313 | |
public void setRequestCharacterEncoding(String encoding) |
314 | |
throws UnsupportedEncodingException |
315 | |
{ |
316 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
317 | |
} |
318 | |
|
319 | |
@Override |
320 | |
public void setResponse(Object response) |
321 | |
{ |
322 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
323 | |
} |
324 | |
|
325 | |
@Override |
326 | |
public void setResponseBufferSize(int size) |
327 | |
{ |
328 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
329 | |
} |
330 | |
|
331 | |
@Override |
332 | |
public void setResponseCharacterEncoding(String encoding) |
333 | |
{ |
334 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
335 | |
} |
336 | |
|
337 | |
@Override |
338 | |
public void setResponseContentLength(int length) |
339 | |
{ |
340 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
341 | |
} |
342 | |
|
343 | |
@Override |
344 | |
public void setResponseContentType(String contentType) |
345 | |
{ |
346 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
347 | |
} |
348 | |
|
349 | |
@Override |
350 | |
public void setResponseHeader(String name, String value) |
351 | |
{ |
352 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
353 | |
} |
354 | |
|
355 | |
@Override |
356 | |
public void setResponseStatus(int statusCode) |
357 | |
{ |
358 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
359 | |
} |
360 | |
|
361 | |
|
362 | |
|
363 | |
|
364 | |
@Override |
365 | |
public void dispatch(String path) throws IOException |
366 | |
{ |
367 | 0 | throw new IllegalStateException(EXCEPTION_TEXT + _getTime()); |
368 | |
} |
369 | |
|
370 | |
|
371 | |
|
372 | |
|
373 | |
@Override |
374 | |
public void redirect(String url) throws IOException |
375 | |
{ |
376 | 0 | throw new IllegalStateException(EXCEPTION_TEXT + _getTime()); |
377 | |
} |
378 | |
|
379 | |
|
380 | |
@Override |
381 | |
public void responseFlushBuffer() throws IOException |
382 | |
{ |
383 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
384 | |
} |
385 | |
|
386 | |
@Override |
387 | |
public void responseReset() |
388 | |
{ |
389 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
390 | |
} |
391 | |
|
392 | |
@Override |
393 | |
public void responseSendError(int statusCode, String message) |
394 | |
throws IOException |
395 | |
{ |
396 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
397 | |
} |
398 | |
|
399 | |
@Override |
400 | |
public void addResponseCookie(String name, String value, |
401 | |
Map<String, Object> properties) |
402 | |
{ |
403 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
404 | |
} |
405 | |
|
406 | |
@Override |
407 | |
public void addResponseHeader(String name, String value) |
408 | |
{ |
409 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
410 | |
} |
411 | |
|
412 | |
@Override |
413 | |
public Flash getFlash() |
414 | |
{ |
415 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
416 | |
} |
417 | |
|
418 | |
@Override |
419 | |
public OutputStream getResponseOutputStream() throws IOException |
420 | |
{ |
421 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
422 | |
} |
423 | |
|
424 | |
@Override |
425 | |
public Writer getResponseOutputWriter() throws IOException |
426 | |
{ |
427 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
428 | |
} |
429 | |
|
430 | |
@Override |
431 | |
public boolean isSecure() |
432 | |
{ |
433 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
434 | |
} |
435 | |
|
436 | |
@Override |
437 | |
public int getSessionMaxInactiveInterval() |
438 | |
{ |
439 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); } |
440 | |
|
441 | |
@Override |
442 | |
public void setSessionMaxInactiveInterval(int interval) |
443 | |
{ |
444 | 0 | throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime()); |
445 | |
} |
446 | |
|
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
private String _getTime() |
454 | |
{ |
455 | 0 | return _startup ? "startup" : "shutdown"; |
456 | |
} |
457 | |
|
458 | |
} |