1
1
/*
2
- * Copyright 2002-2009 the original author or authors.
2
+ * Copyright 2002-2011 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
18
18
19
19
import java .lang .reflect .Method ;
20
20
import java .util .Map ;
21
+ import javax .faces .application .Application ;
22
+ import javax .faces .component .UIViewRoot ;
21
23
import javax .faces .context .ExternalContext ;
22
24
import javax .faces .context .FacesContext ;
23
25
import javax .portlet .PortletSession ;
@@ -166,6 +168,9 @@ else if ("sessionScope".equals(key)) {
166
168
else if ("applicationScope" .equals (key )) {
167
169
return getExternalContext ().getApplicationMap ();
168
170
}
171
+ else if ("facesContext" .equals (key )) {
172
+ return getFacesContext ();
173
+ }
169
174
else if ("cookie" .equals (key )) {
170
175
return getExternalContext ().getRequestCookieMap ();
171
176
}
@@ -187,8 +192,29 @@ else if ("initParam".equals(key)) {
187
192
else if ("view" .equals (key )) {
188
193
return getFacesContext ().getViewRoot ();
189
194
}
190
- else if ("facesContext" .equals (key )) {
191
- return getFacesContext ();
195
+ else if ("viewScope" .equals (key )) {
196
+ try {
197
+ return ReflectionUtils .invokeMethod (UIViewRoot .class .getMethod ("getViewMap" ), getFacesContext ().getViewRoot ());
198
+ }
199
+ catch (NoSuchMethodException ex ) {
200
+ throw new IllegalStateException ("JSF 2.0 API not available" , ex );
201
+ }
202
+ }
203
+ else if ("flash" .equals (key )) {
204
+ try {
205
+ return ReflectionUtils .invokeMethod (ExternalContext .class .getMethod ("getFlash" ), getExternalContext ());
206
+ }
207
+ catch (NoSuchMethodException ex ) {
208
+ throw new IllegalStateException ("JSF 2.0 API not available" , ex );
209
+ }
210
+ }
211
+ else if ("resource" .equals (key )) {
212
+ try {
213
+ return ReflectionUtils .invokeMethod (Application .class .getMethod ("getResourceHandler" ), getFacesContext ().getApplication ());
214
+ }
215
+ catch (NoSuchMethodException ex ) {
216
+ throw new IllegalStateException ("JSF 2.0 API not available" , ex );
217
+ }
192
218
}
193
219
else {
194
220
return null ;
0 commit comments