1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package javax.faces.context;
20
21 import java.util.Iterator;
22 import java.util.Locale;
23 import java.util.Map;
24 import java.util.Set;
25
26
27
28
29
30
31
32 public abstract class ExternalContext
33 {
34 public static final String BASIC_AUTH = "BASIC";
35 public static final String CLIENT_CERT_AUTH = "CLIENT_CERT";
36 public static final String DIGEST_AUTH = "DIGEST";
37 public static final String FORM_AUTH = "FORM";
38
39 private static ThreadLocal<ExternalContext> _firstInstance = new ThreadLocal<ExternalContext>();
40
41 public abstract void dispatch(String path)
42 throws java.io.IOException;
43
44 public abstract String encodeActionURL(String url);
45
46 public abstract String encodeNamespace(String name);
47
48 public abstract String encodeResourceURL(String url);
49
50 public abstract Map<String, Object> getApplicationMap();
51
52 public abstract String getAuthType();
53
54 public abstract Object getContext();
55
56 public abstract String getInitParameter(String name);
57
58 public abstract Map getInitParameterMap();
59
60 public abstract String getRemoteUser();
61
62 public abstract Object getRequest();
63
64 public String getRequestCharacterEncoding()
65 {
66 ExternalContext ctx = _firstInstance.get();
67
68 if (ctx == null)
69 {
70 throw new UnsupportedOperationException();
71 }
72
73 return ctx.getRequestCharacterEncoding();
74 }
75
76 public String getRequestContentType()
77 {
78 ExternalContext ctx = _firstInstance.get();
79
80 if (ctx == null)
81 {
82 throw new UnsupportedOperationException();
83 }
84
85 return ctx.getRequestContentType();
86 }
87
88 public abstract String getRequestContextPath();
89
90 public abstract Map<String, Object> getRequestCookieMap();
91
92 public abstract Map<String, String> getRequestHeaderMap();
93
94 public abstract Map<String, String[]> getRequestHeaderValuesMap();
95
96 public abstract Locale getRequestLocale();
97
98 public abstract Iterator<Locale> getRequestLocales();
99
100 public abstract Map<String, Object> getRequestMap();
101
102 public abstract Map<String, String> getRequestParameterMap();
103
104 public abstract Iterator<String> getRequestParameterNames();
105
106 public abstract Map<String, String[]> getRequestParameterValuesMap();
107
108 public abstract String getRequestPathInfo();
109
110 public abstract String getRequestServletPath();
111
112 public abstract java.net.URL getResource(String path)
113 throws java.net.MalformedURLException;
114
115 public abstract java.io.InputStream getResourceAsStream(String path);
116
117 public abstract Set<String> getResourcePaths(String path);
118
119 public abstract Object getResponse();
120
121
122
123
124
125 public String getResponseContentType()
126 {
127 ExternalContext ctx = _firstInstance.get();
128
129 if (ctx == null)
130 {
131 throw new UnsupportedOperationException();
132 }
133
134 return ctx.getResponseContentType();
135 }
136
137 public abstract Object getSession(boolean create);
138
139 public abstract Map<String, Object> getSessionMap();
140
141 public abstract java.security.Principal getUserPrincipal();
142
143
144
145
146
147
148 public void setRequest(java.lang.Object request)
149 {
150 ExternalContext ctx = _firstInstance.get();
151
152 if (ctx == null)
153 {
154 throw new UnsupportedOperationException();
155 }
156
157 ctx.setRequest(request);
158 }
159
160
161
162
163
164
165
166 public void setRequestCharacterEncoding(java.lang.String encoding)
167 throws java.io.UnsupportedEncodingException
168 {
169 ExternalContext ctx = _firstInstance.get();
170
171 if (ctx == null)
172 {
173 throw new UnsupportedOperationException();
174 }
175
176 ctx.setRequestCharacterEncoding(encoding);
177 }
178
179
180
181
182
183
184 public void setResponse(java.lang.Object response)
185 {
186 ExternalContext ctx = _firstInstance.get();
187
188 if (ctx == null)
189 {
190 throw new UnsupportedOperationException();
191 }
192
193 ctx.setResponse(response);
194 }
195
196
197
198
199
200
201 public void setResponseCharacterEncoding(java.lang.String encoding)
202 {
203 ExternalContext ctx = _firstInstance.get();
204
205 if (ctx == null)
206 {
207 throw new UnsupportedOperationException();
208 }
209
210 ctx.setResponseCharacterEncoding(encoding);
211 }
212
213 public String getResponseCharacterEncoding()
214 {
215 ExternalContext ctx = _firstInstance.get();
216
217 if (ctx == null)
218 {
219 throw new UnsupportedOperationException("JSF 1.2 : figure out how to tell if this is a Portlet request");
220 }
221
222 return ctx.getResponseCharacterEncoding();
223 }
224
225 public abstract boolean isUserInRole(String role);
226
227 public abstract void log(String message);
228
229 public abstract void log(String message,
230 Throwable exception);
231
232 public abstract void redirect(String url)
233 throws java.io.IOException;
234 }