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