View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.shared.config;
20  
21  import java.util.logging.Logger;
22  
23  import javax.faces.context.ExternalContext;
24  import javax.servlet.ServletContext;
25  
26  import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
27  import org.apache.myfaces.shared.util.ClassUtils;
28  import org.apache.myfaces.shared.util.WebConfigParamUtils;
29  
30  /**
31   * Holds all configuration init parameters (from web.xml) that are independent
32   * from the core implementation. The parameters in this class are available to
33   * all shared, component and implementation classes.
34   * See RuntimeConfig for configuration infos that come from the faces-config
35   * files and are needed by the core implementation.
36   *
37   * MyfacesConfig is meant for components that implement some of the extended features
38   * of MyFaces. Anyhow, using the MyFaces JSF implementation is no precondition for using
39   * MyfacesConfig in custom components. Upon using another JSF implementation
40   * (or omitting the extended init parameters) all config properties will simply have
41   * their default values.
42   *
43   * @author Manfred Geiler (latest modification by $Author: lu4242 $)
44   * @version $Revision: 1533114 $ $Date: 2013-10-17 10:25:52 -0500 (Thu, 17 Oct 2013) $
45   */
46  public class MyfacesConfig
47  {
48      //private static final Log log = LogFactory.getLog(MyfacesConfig.class);
49      private static final Logger log = Logger.getLogger(MyfacesConfig.class.getName());
50  
51      private static final String APPLICATION_MAP_PARAM_NAME = MyfacesConfig.class.getName();
52  
53      /**
54       * Set the virtual path used to serve resources using tomahawk addResource API. Note ExtensionsFilter should
55       * be able to receive request on the prefix used here.
56       */
57      @JSFWebConfigParam(tags="tomahawk")
58      public static final String  INIT_PARAM_RESOURCE_VIRTUAL_PATH = "org.apache.myfaces.RESOURCE_VIRTUAL_PATH";
59      public static final String  INIT_PARAM_RESOURCE_VIRTUAL_PATH_DEFAULT = "/faces/myFacesExtensionResource";
60  
61      /**
62       * If true, rendered HTML code will be formatted, so that it is "human readable".
63       * i.e. additional line separators and whitespace will be written, that do not
64       * influence the HTML code. Default: "true"
65       */
66      @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1",
67              ignoreUpperLowerCase=true, group="render")
68      private static final String  INIT_PARAM_PRETTY_HTML = "org.apache.myfaces.PRETTY_HTML";
69      private static final boolean INIT_PARAM_PRETTY_HTML_DEFAULT = true;
70  
71      /**
72       * This parameter tells MyFaces if javascript code should be allowed in the rendered HTML output.
73       * If javascript is allowed, command_link anchors will have javascript code 
74       * that submits the corresponding form.
75       * If javascript is not allowed, the state saving info and nested parameters ill be 
76       * added as url parameters.
77       * Default: "true"
78       */
79      @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1",
80              ignoreUpperLowerCase=true, group="render")
81      private static final String  INIT_PARAM_ALLOW_JAVASCRIPT = "org.apache.myfaces.ALLOW_JAVASCRIPT";
82      private static final boolean INIT_PARAM_ALLOW_JAVASCRIPT_DEFAULT = true;
83  
84      /**
85       * Deprecated: tomahawk specific param to detect javascript, but it is no longer valid anymore.
86       */
87      @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.1",
88              ignoreUpperLowerCase=true, deprecated=true, tags="tomahawk", group="render")
89      private static final String  INIT_PARAM_DETECT_JAVASCRIPT = "org.apache.myfaces.DETECT_JAVASCRIPT";
90      private static final boolean INIT_PARAM_DETECT_JAVASCRIPT_DEFAULT = false;
91  
92      /**
93       * If true, a javascript function will be rendered that is able to restore the 
94       * former vertical scroll on every request. Convenient feature if you have pages
95       * with long lists and you do not want the browser page to always jump to the top
96       * if you trigger a link or button action that stays on the same page.
97       * Default: "false"
98       */
99      @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.1", 
100             ignoreUpperLowerCase=true, tags="tomahawk")
101     private static final String  INIT_PARAM_AUTO_SCROLL = "org.apache.myfaces.AUTO_SCROLL";
102     private static final boolean INIT_PARAM_AUTO_SCROLL_DEFAULT = false;
103 
104     /**
105      * Tomahawk specific: A class implementing the
106      * org.apache.myfaces.shared.renderkit.html.util.AddResource
107      * interface. It is responsible to
108      * place scripts and css on the right position in your HTML document.
109      * Default: "org.apache.myfaces.shared.renderkit.html.util.DefaultAddResource"
110      * Follow the description on the MyFaces-Wiki-Performance page to enable
111      * StreamingAddResource instead of DefaultAddResource if you want to
112      * gain performance.
113      */
114     @JSFWebConfigParam(defaultValue="org.apache.myfaces. renderkit.html.util. DefaultAddResource",since="1.1",
115             desc="Tomahawk specific: Indicate the class responsible to place scripts and css using " +
116                  "tomahawk AddResource API", tags="tomahawk")
117     private static final String INIT_PARAM_ADD_RESOURCE_CLASS = "org.apache.myfaces.ADD_RESOURCE_CLASS";
118     private static final String INIT_PARAM_ADD_RESOURCE_CLASS_DEFAULT = 
119         "org.apache.myfaces.renderkit.html.util.DefaultAddResource";
120 
121     /**
122      * Tomahawk specific: A very common problem in configuring MyFaces-web-applications
123      * is that the Extensions-Filter is not configured at all
124      * or improperly configured. This parameter will check for a properly
125      * configured Extensions-Filter if it is needed by the web-app.
126      * In most cases this check will work just fine, there might be cases
127      * where an internal forward will bypass the Extensions-Filter and the check
128      * will not work. If this is the case, you can disable the check by setting
129      * this parameter to false.
130      * 
131      * In tomahawk for JSF 2.0 since version 1.1.11, this param is set by default to false, otherwise is true.
132      */
133     @JSFWebConfigParam(defaultValue="for JSF 2.0 since 1.1.11 false, otherwise true", 
134             expectedValues="true, false, on, off, yes, no",since="1.1", ignoreUpperLowerCase=true,
135             desc="Tomahawk specific: This parameter will check for a properly configured Extensions-Filter if " +
136                  "it is needed by the web-app.", tags="tomahawk")
137     private static final String  INIT_CHECK_EXTENSIONS_FILTER = "org.apache.myfaces.CHECK_EXTENSIONS_FILTER";
138     private static final boolean INIT_CHECK_EXTENSIONS_FILTER_DEFAULT = false;
139 
140     /**
141      * Tomahawk specific: Interpret "readonly" property as "disable" for select components like t:selectOneRow.
142      */
143     @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1", 
144             ignoreUpperLowerCase=true, tags="tomahawk", group="render")
145     private static final String INIT_READONLY_AS_DISABLED_FOR_SELECT = 
146         "org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS";
147     private static final boolean INIT_READONLY_AS_DISABLED_FOR_SELECT_DEFAULT = true;
148 
149     /**
150      * Set the time in seconds that check for updates of web.xml and faces-config descriptors and 
151      * refresh the configuration.
152      * This param is valid only if project stage is not production. Set this param to 0 disable this feature.
153      */
154     @JSFWebConfigParam(defaultValue="2",since="1.1", classType="java.lang.Long")
155     public static final String INIT_PARAM_CONFIG_REFRESH_PERIOD = "org.apache.myfaces.CONFIG_REFRESH_PERIOD";
156     public static final long INIT_PARAM_CONFIG_REFRESH_PERIOD_DEFAULT = 2;
157 
158     /**
159      * Set the view state using a javascript function instead a hidden input field.
160      */
161     @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.1", 
162             ignoreUpperLowerCase=true, deprecated=true, group="state")
163     private static final String  INIT_PARAM_VIEWSTATE_JAVASCRIPT = "org.apache.myfaces.VIEWSTATE_JAVASCRIPT";
164     private static final boolean INIT_PARAM_VIEWSTATE_JAVASCRIPT_DEFAULT = false;
165 
166     /**
167      * Define if the input field that should store the state (javax.faces.ViewState) should render 
168      * id="javax.faces.ViewState".
169      * 
170      * JSF API 1.2 defines a "javax.faces.ViewState" client parameter, that must be rendered as both the "name"
171      * and the "id" attribute of the hidden input that is rendered for the purpose of state saving
172      * (see ResponseStateManager.VIEW_STATE_PARAM).
173      * Actually this causes duplicate id attributes and thus invalid XHTML pages when multiple forms are rendered on
174      * one page. With the org.apache.myfaces.RENDER_VIEWSTATE_ID context parameter you can tune this behaviour.
175      * <br/>Set it to
176      * <ul><li>true - to render JSF 1.2 compliant id attributes (that might cause invalid XHTML), or</li>
177      * <li>false - to omit rendering of the id attribute (which is only needed for very special 
178      * AJAX/Javascript components)</li></ul>
179      * Default value is: true (for backwards compatibility and JSF 1.2 compliancy) 
180      */
181     @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1", 
182             ignoreUpperLowerCase=true, group="state")
183     private static final String  INIT_PARAM_RENDER_VIEWSTATE_ID = "org.apache.myfaces.RENDER_VIEWSTATE_ID";
184     private static final boolean INIT_PARAM_RENDER_VIEWSTATE_ID_DEFAULT = true;
185 
186     /**
187      * Use "&amp;amp;" entity instead a plain "&amp;" character within HTML.
188      * <p>W3C recommends to use the "&amp;amp;" entity instead of a plain "&amp;" character within HTML.
189      * This also applies to attribute values and thus to the "href" attribute of &lt;a&gt; elements as well.
190      * Even more, when XHTML is used as output the usage of plain "&amp;" characters is forbidden and would lead to
191      * invalid XML code.
192      * Therefore, since version 1.1.6 MyFaces renders the correct "&amp;amp;" entity for links.</p>
193      * <p>The init parameter
194      * org.apache.myfaces.STRICT_XHTML_LINKS makes it possible to restore the old behaviour and to make MyFaces
195      * "bug compatible" to the Sun RI which renders plain "&amp;" chars in links as well.</p>
196      * <p>
197      * See: <a href="http://www.w3.org/TR/html401/charset.html#h-5.3.2">HTML 4.01 Specification</a>
198      * See: <a href="http://issues.apache.org/jira/browse/MYFACES-1774">Jira: MYFACES-1774</a>
199      * </p>
200      */
201     @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1.6", 
202             ignoreUpperLowerCase=true, group="render")
203     private static final String  INIT_PARAM_STRICT_XHTML_LINKS = "org.apache.myfaces.STRICT_XHTML_LINKS";
204     private static final boolean INIT_PARAM_STRICT_XHTML_LINKS_DEFAULT = true;
205     
206     /**
207      * This param renders the clear javascript on button necessary only for
208      * compatibility with hidden fields feature of myfaces. This is done 
209      * because jsf ri does not render javascript on onclick method for button,
210      * so myfaces should do this.
211      */
212     @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.2.3",
213             ignoreUpperLowerCase=true, group="render")
214     private static final String INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON = 
215         "org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON";
216     private static final boolean INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT= false;
217 
218     /**
219      * This param renders hidden fields at the end of h:form for link params when h:commandLink + f:param is used,
220      * instead use javascript to create them. Set this param to true also enables 
221      * org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON 
222      * automatically to ensure consistency. This feature is required to support Windows Mobile 6, because in 
223      * this environment, document.createElement() and form.appendChild() javascript methods are not supported.
224      */
225     @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.2.9",
226             ignoreUpperLowerCase=true, group="render")
227     private static final String INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS = 
228         "org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS";
229     private static final boolean INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS_DEFAULT= false;
230     
231     /**
232      * Add a code that save the form before submit using a
233      * link (call to window.external.AutoCompleteSaveForm(form) ). It's a bug on IE.
234      */
235     @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.1",
236             ignoreUpperLowerCase=true, group="render")
237     private static final String INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE = "org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE";
238     private static final boolean INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE_DEFAULT = false;
239     
240     /**
241      * Define an alternate class name that will be used to initialize MyFaces, instead the default 
242      * javax.faces.webapp.FacesServlet.
243      * 
244      * <p>This helps MyFaces to detect the mappings and other additional configuration used to setup the 
245      * environment, and prevent abort initialization if no FacesServlet config is detected.
246      * </p>
247      */
248     @JSFWebConfigParam(since="1.2.7")
249     private static final String INIT_PARAM_DELEGATE_FACES_SERVLET = "org.apache.myfaces.DELEGATE_FACES_SERVLET";
250 
251     /**
252      * Indicate if the facelet associated to the view should be reapplied when the view is refreshed.
253      *  Default mode is "auto".
254      * 
255      * <p>This param is only valid when partial state saving is on.
256      * If this is set as true, the tag-handlers are always reapplied before render view, like in facelets 1.1.x, 
257      * allowing c:if work correctly to "toggle" components based on a value changed on invoke application phase. 
258      * If the param is set as "auto", the implementation check if c:if, c:forEach, 
259      * c:choose and ui:include with src=ELExpression is used on the page and if that so, mark the view
260      * to be refreshed.</p> 
261      */
262     @JSFWebConfigParam(since="2.0", defaultValue="auto", expectedValues="true,false,auto", tags="performance", 
263             ignoreUpperLowerCase=true, group="state")
264     public final static String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS = 
265         "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS"; 
266     public final static String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT = "auto";
267 
268     /**
269      * Enable or disable a special mode that enable full state for parent components containing c:if, c:forEach, 
270      * c:choose and ui:include with src=ELExpression. By default is disabled(false).
271      * 
272      * <p>This param is only valid when partial state saving is on.
273      * If this is set as true, parent components containing  c:if, c:forEach, 
274      * c:choose and ui:include with src=ELExpression are marked to be restored fully, so state
275      * is preserved between request.</p>
276      */
277     @JSFWebConfigParam(since="2.0", defaultValue="false", expectedValues="true, false, on, off, yes, no", 
278             tags="performance", ignoreUpperLowerCase=true, group="state")
279     public final static String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE = 
280         "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE";
281     public final static boolean INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT = false;
282     
283     /**
284      * If set to <code>true</code>, tag library XML files and faces config XML files using schema 
285      * will be validated during application start up
286      */
287     @JSFWebConfigParam(since="2.0", expectedValues="true, false, on, off, yes, no", ignoreUpperLowerCase=true)
288     public final static String INIT_PARAM_VALIDATE_XML = "org.apache.myfaces.VALIDATE_XML";
289     public final static boolean INIT_PARAM_VALIDATE_XML_DEFAULT = false;
290     
291     /**
292      * Wrap content inside script with xml comment to prevent old browsers to display it. By default it is true. 
293      */
294     @JSFWebConfigParam(since="2.0.1", expectedValues="true, false, on, off, yes, no", defaultValue="true",
295             ignoreUpperLowerCase=true, group="render")
296     public final static String INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG = 
297         "org.apache.myfaces.WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG";
298     public final static boolean INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT = true;
299     
300     /**
301      * If set true, render the form submit script inline, as in myfaces core 1.2 and earlier versions 
302      */
303     @JSFWebConfigParam(since="2.0.2", expectedValues="true, false, on, off, yes, no", defaultValue="false", 
304             ignoreUpperLowerCase=true, group="render")
305     public final static String INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE = 
306         "org.apache.myfaces.RENDER_FORM_SUBMIT_SCRIPT_INLINE";
307     public final static boolean INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_DEFAULT = false;
308     
309     /**
310      * Enable/disable DebugPhaseListener feature, with provide useful information about ValueHolder 
311      * variables (submittedValue, localValue, value).
312      * Note evaluate those getters for each component could cause some unwanted side effects when 
313      * using "access" type scopes like on MyFaces CODI.
314      * This param only has effect when project stage is Development.     
315      */
316     @JSFWebConfigParam(since="2.0.8")
317     public final static String INIT_PARAM_DEBUG_PHASE_LISTENER = "org.apache.myfaces.DEBUG_PHASE_LISTENER";
318     public final static boolean INIT_PARAM_DEBUG_PHASE_LISTENER_DEFAULT = false;
319     
320     /**
321      * Detect if a target (usually head) should be update for the current view in an ajax render 
322      * operation. This is activated if a css or js resource is added dynamically by effect of a refresh 
323      * (c:if, ui:include src="#{...}" or a manipulation of the tree). This ensures ajax updates of content 
324      * using ui:include will be consistent. Note this behavior is a myfaces specific extension, so to 
325      * ensure strict compatibility with the spec, set this param to false (default false).
326      */
327     @JSFWebConfigParam(since="2.0.10", expectedValues="true, false", defaultValue="false")
328     public final static String INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX = 
329         "org.apache.myfaces.STRICT_JSF_2_REFRESH_TARGET_AJAX";
330     public final static boolean INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX_DEFAULT = false;
331     
332     /**
333      * Change default getType() behavior for composite component EL resolver, from return null 
334      * (see JSF 2_0 spec section 5_6_2_2) to
335      * use the metadata information added by composite:attribute, ensuring components working with 
336      * chained EL expressions to find the
337      * right type when a getType() is called over the source EL expression.
338      * 
339      * To ensure strict compatibility with the spec set this param to true (by default is false, 
340      * so the change is enabled by default). 
341      */
342     @JSFWebConfigParam(since="2.0.10", expectedValues="true, false", defaultValue="false", group="EL")
343     public final static String INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER = 
344         "org.apache.myfaces.STRICT_JSF_2_CC_EL_RESOLVER";
345     public final static boolean INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT = false;
346     
347     /**
348      * Define the default content type that the default ResponseWriter generates, when no match can be derived from
349      * HTTP Accept Header.
350      */
351     @JSFWebConfigParam(since="2.0.11,2.1.5", expectedValues="text/html, application/xhtml+xml", 
352             defaultValue="text/html", group="render")
353     public final static String INIT_PARAM_DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE = 
354         "org.apache.myfaces.DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE";
355     public final static String INIT_PARAM_DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT = "text/html";
356 
357     /**
358      * Enable or disable a cache used to "remember" the generated facelets unique ids and reduce 
359      * the impact on memory usage, only active if javax.faces.FACELETS_REFRESH_PERIOD is -1 (no refresh).
360      */
361     @JSFWebConfigParam(defaultValue = "false", since = "2.0.13, 2.1.7", expectedValues="true, false", 
362             group="viewhandler", tags="performance",
363             desc="Enable or disable a cache used to 'remember'  the generated facelets unique ids " + 
364                  "and reduce the impact over memory usage.")
365     public static final String INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED = 
366         "org.apache.myfaces.VIEW_UNIQUE_IDS_CACHE_ENABLED";
367     public static final boolean INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT = false;
368     
369     /**
370      * Set the size of the cache used to store strings generated using SectionUniqueIdCounter
371      * for component ids. If this is set to 0, no cache is used. By default is set to 100.
372      */
373     @JSFWebConfigParam(defaultValue = "100", since = "2.0.13, 2.1.7",
374             group="viewhandler", tags="performance")
375     public static final String INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE =
376         "org.apache.myfaces.COMPONENT_UNIQUE_IDS_CACHE_SIZE";
377     public static final int INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT = 100;
378 
379     /**
380     * If set false, myfaces won't support JSP and javax.faces.el. JSP are deprecated in JSF 2.X, javax.faces.el in 
381     * in JSF 1.2. Default value is true. 
382     * 
383     * If this property is set is false, JSF 1.1 VariableResolver and PropertyResolver config (replaced in JSF 1.2 by
384     * ELResolver) and all related logic for JSP is skipped, making EL evaluation faster.  
385     */
386     @JSFWebConfigParam(since="2.0.13,2.1.7", expectedValues="true,false", defaultValue="true",
387          desc="If set false, myfaces won't support JSP and javax.faces.el. JSP are deprecated in " +
388          "JSF 2.X, javax.faces.el in in JSF 1.2. Default value is true.",
389          group="EL", tags="performance ")
390     public final static String INIT_PARAM_SUPPORT_JSP_AND_FACES_EL = "org.apache.myfaces.SUPPORT_JSP_AND_FACES_EL";
391     public final static boolean INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT = true;
392     
393     /**
394      * When the application runs inside Google Application Engine container (GAE),
395      * indicate which jar files should be scanned for files (faces-config, facelets taglib
396      * or annotations). It accept simple wildcard patterns like myfavoritejsflib-*.jar or 
397      * myfavoritejsflib-1.1.?.jar. By default, all the classpath is scanned for files 
398      * annotations (so it adds an small delay on startup).
399      */
400     @JSFWebConfigParam(since = "2.1.8, 2.0.14", expectedValues="none, myfavoritejsflib-*.jar",
401             tags="performance, GAE")
402     public static final String INIT_PARAM_GAE_JSF_JAR_FILES = "org.apache.myfaces.GAE_JSF_JAR_FILES";
403     public final static String INIT_PARAM_GAE_JSF_JAR_FILES_DEFAULT = null;
404 
405     /**
406      * When the application runs inside Google Application Engine container (GAE),
407      * indicate which jar files should be scanned for annotations. This param overrides
408      * org.apache.myfaces.GAE_JSF_JAR_FILES behavior that tries to find faces-config.xml or
409      * files ending with .faces-config.xml in /META-INF folder and if that so, try to
410      * find JSF annotations in the whole jar file. It accept simple wildcard patterns 
411      * like myfavoritejsflib-*.jar or myfavoritejsflib-1.1.?.jar.
412      * By default, all the classpath is scanned for annotations (so it adds an small
413      * delay on startup).
414      */
415     @JSFWebConfigParam(since = "2.1.8, 2.0.14", expectedValues="none, myfavoritejsflib-*.jar",
416             tags="performance, GAE")
417     public static final String INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES = 
418             "org.apache.myfaces.GAE_JSF_ANNOTATIONS_JAR_FILES";
419     public final static String INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES_DEFAULT = null;
420     
421     /**
422      * If this param is set to true, a check will be done in Restore View Phase to check
423      * if the viewId exists or not and if it does not exists, a 404 response will be thrown.
424      * 
425      * This is applicable in cases where all the views in the application are generated by a 
426      * ViewDeclarationLanguage implementation.
427      */
428     @JSFWebConfigParam(since = "2.1.13", defaultValue="false", expectedValues="true,false", 
429             group="viewhandler")
430     public static final String INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND = 
431             "org.apache.myfaces.STRICT_JSF_2_VIEW_NOT_FOUND";
432     public final static boolean INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT = false;
433 
434     private boolean _prettyHtml;
435     private boolean _detectJavascript;
436     private boolean _allowJavascript;
437     private boolean _autoScroll;
438     private String _addResourceClass;
439     private String _resourceVirtualPath;
440     private boolean _checkExtensionsFilter;
441     private boolean _readonlyAsDisabledForSelect;
442     private long _configRefreshPeriod;
443     private boolean _viewStateJavascript;
444     private boolean _renderViewStateId;
445     private boolean _strictXhtmlLinks;
446     private boolean _renderClearJavascriptOnButton;
447     private boolean renderHiddenFieldsForLinkParams;
448     private boolean _saveFormSubmitLinkIE;
449     private String _delegateFacesServlet;
450     private boolean _refreshTransientBuildOnPSS;
451     private boolean _refreshTransientBuildOnPSSAuto;
452     private boolean refreshTransientBuildOnPSSPreserveState;
453     private boolean _validateXML;
454     private boolean _wrapScriptContentWithXmlCommentTag;
455     private boolean _renderFormSubmitScriptInline;
456     private boolean _debugPhaseListenerEnabled;
457     private boolean _strictJsf2RefreshTargetAjax;
458     private boolean _strictJsf2CCELResolver;
459     private String _defaultResponseWriterContentTypeMode;
460     private boolean _viewUniqueIdsCacheEnabled;
461     private int _componentUniqueIdsCacheSize;
462     private boolean _supportJSPAndFacesEL;
463     private String _gaeJsfJarFiles;
464     private String _gaeJsfAnnotationsJarFiles;
465     private boolean _strictJsf2ViewNotFound;
466 
467     private static final boolean TOMAHAWK_AVAILABLE;
468     private static final boolean MYFACES_IMPL_AVAILABLE;
469     private static final boolean RI_IMPL_AVAILABLE;
470 
471     static
472     {
473         boolean tomahawkAvailable;
474         try
475         {
476             ClassUtils.classForName("org.apache.myfaces.webapp.filter.ExtensionsFilter");
477             tomahawkAvailable = true;
478         }
479         catch (ClassNotFoundException e)
480         {
481             tomahawkAvailable = false;
482         }
483         TOMAHAWK_AVAILABLE = tomahawkAvailable;
484     }
485 
486     static
487     {
488         boolean myfacesImplAvailable;
489         try
490         {
491             ClassUtils.classForName("org.apache.myfaces.application.ApplicationImpl");
492             myfacesImplAvailable = true;
493         }
494         catch (ClassNotFoundException e)
495         {
496             myfacesImplAvailable = false;
497         }
498         MYFACES_IMPL_AVAILABLE = myfacesImplAvailable;
499     }
500 
501     static
502     {
503         boolean riImplAvailable;
504         try
505         {
506             ClassUtils.classForName("com.sun.faces.application.ApplicationImpl");
507             riImplAvailable = true;
508         }
509         catch (ClassNotFoundException e)
510         {
511             riImplAvailable = false;
512         }
513         RI_IMPL_AVAILABLE = riImplAvailable;
514     }
515 
516     public static MyfacesConfig getCurrentInstance(ExternalContext extCtx)
517     {
518         MyfacesConfig myfacesConfig = (MyfacesConfig) extCtx
519                 .getApplicationMap().get(APPLICATION_MAP_PARAM_NAME);
520         if (myfacesConfig == null)
521         {
522 
523             myfacesConfig = createAndInitializeMyFacesConfig(extCtx);
524 
525             extCtx.getApplicationMap().put(APPLICATION_MAP_PARAM_NAME, myfacesConfig);
526 
527         }
528 
529         return myfacesConfig;
530     }
531     
532     public MyfacesConfig()
533     {
534         setPrettyHtml(INIT_PARAM_PRETTY_HTML_DEFAULT);
535         setAllowJavascript(INIT_PARAM_ALLOW_JAVASCRIPT_DEFAULT);
536         setRenderClearJavascriptOnButton(INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT);
537         setRenderHiddenFieldsForLinkParams(INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS_DEFAULT);
538         setSaveFormSubmitLinkIE(INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE_DEFAULT);
539         setReadonlyAsDisabledForSelect(INIT_READONLY_AS_DISABLED_FOR_SELECT_DEFAULT);
540         setRenderViewStateId(INIT_PARAM_RENDER_VIEWSTATE_ID_DEFAULT);
541         setStrictXhtmlLinks(INIT_PARAM_STRICT_XHTML_LINKS_DEFAULT);
542         setConfigRefreshPeriod(INIT_PARAM_CONFIG_REFRESH_PERIOD_DEFAULT);        
543         setViewStateJavascript(INIT_PARAM_VIEWSTATE_JAVASCRIPT_DEFAULT);        
544         setRefreshTransientBuildOnPSS(true);
545         setRefreshTransientBuildOnPSSAuto(true);
546         setRefreshTransientBuildOnPSSPreserveState(INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT);
547         setValidateXML(INIT_PARAM_VALIDATE_XML_DEFAULT);
548         setWrapScriptContentWithXmlCommentTag(INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT);
549         setDetectJavascript(INIT_PARAM_DETECT_JAVASCRIPT_DEFAULT);
550         setAutoScroll(INIT_PARAM_AUTO_SCROLL_DEFAULT);
551         setAddResourceClass(INIT_PARAM_ADD_RESOURCE_CLASS_DEFAULT);
552         setResourceVirtualPath(INIT_PARAM_RESOURCE_VIRTUAL_PATH_DEFAULT);
553         //The default is true but we'll let it false because it depends if 
554         //tomahawk is on classpath and no test environment is set
555         setCheckExtensionsFilter(false);
556         setRenderFormSubmitScriptInline(INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_DEFAULT);
557         setDebugPhaseListenerEnabled(INIT_PARAM_DEBUG_PHASE_LISTENER_DEFAULT);
558         setStrictJsf2RefreshTargetAjax(INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX_DEFAULT);
559         setStrictJsf2CCELResolver(INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT);
560         setDefaultResponseWriterContentTypeMode(INIT_PARAM_DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT);
561         setViewUniqueIdsCacheEnabled(INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT);
562         setComponentUniqueIdsCacheSize(INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT);
563         setSupportJSPAndFacesEL(INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT);
564         setGaeJsfJarFiles(INIT_PARAM_GAE_JSF_JAR_FILES_DEFAULT);
565         setGaeJsfAnnotationsJarFiles(INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES_DEFAULT);
566         setStrictJsf2ViewNotFound(INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT);
567     }
568 
569     private static MyfacesConfig createAndInitializeMyFacesConfig(ExternalContext extCtx)
570     {
571         
572         MyfacesConfig myfacesConfig = new MyfacesConfig();
573 
574         myfacesConfig.setPrettyHtml(getBooleanInitParameter(extCtx, INIT_PARAM_PRETTY_HTML,
575                                                             INIT_PARAM_PRETTY_HTML_DEFAULT));
576         myfacesConfig.setAllowJavascript(getBooleanInitParameter(extCtx, INIT_PARAM_ALLOW_JAVASCRIPT,
577                                                                  INIT_PARAM_ALLOW_JAVASCRIPT_DEFAULT));
578 
579         myfacesConfig.setRenderClearJavascriptOnButton(getBooleanInitParameter(extCtx, 
580                                                             INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON,
581                                                             INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT));
582 
583         myfacesConfig.setRenderHiddenFieldsForLinkParams(getBooleanInitParameter(extCtx, 
584                 INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS,
585                 INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS_DEFAULT));
586 
587         myfacesConfig.setSaveFormSubmitLinkIE(getBooleanInitParameter(extCtx, INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE,
588                                                             INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE_DEFAULT));
589         
590         myfacesConfig.setReadonlyAsDisabledForSelect(getBooleanInitParameter(extCtx, 
591                                                                  INIT_READONLY_AS_DISABLED_FOR_SELECT,
592                                                                  INIT_READONLY_AS_DISABLED_FOR_SELECT_DEFAULT));
593         myfacesConfig.setRenderViewStateId(getBooleanInitParameter(extCtx, INIT_PARAM_RENDER_VIEWSTATE_ID,
594                                                                    INIT_PARAM_RENDER_VIEWSTATE_ID_DEFAULT));
595         myfacesConfig.setStrictXhtmlLinks(getBooleanInitParameter(extCtx, INIT_PARAM_STRICT_XHTML_LINKS,
596                                                                   INIT_PARAM_STRICT_XHTML_LINKS_DEFAULT));
597         myfacesConfig.setRenderFormSubmitScriptInline(getBooleanInitParameter(extCtx,
598                                                                   INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE,
599                                                                   INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_DEFAULT));
600         
601         myfacesConfig.setConfigRefreshPeriod(getLongInitParameter(extCtx, INIT_PARAM_CONFIG_REFRESH_PERIOD,
602                 INIT_PARAM_CONFIG_REFRESH_PERIOD_DEFAULT));
603 
604         myfacesConfig.setViewStateJavascript(getBooleanInitParameter(extCtx, INIT_PARAM_VIEWSTATE_JAVASCRIPT,
605                 INIT_PARAM_VIEWSTATE_JAVASCRIPT_DEFAULT));
606 
607         myfacesConfig.setDelegateFacesServlet(extCtx.getInitParameter(INIT_PARAM_DELEGATE_FACES_SERVLET));
608         
609         String refreshTransientBuildOnPSS = getStringInitParameter(extCtx, 
610                 INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS, 
611                 INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT);
612         
613         if (refreshTransientBuildOnPSS == null)
614         {
615             myfacesConfig.setRefreshTransientBuildOnPSS(false);
616             myfacesConfig.setRefreshTransientBuildOnPSSAuto(false);
617         }
618         else if ("auto".equalsIgnoreCase(refreshTransientBuildOnPSS))
619         {
620             myfacesConfig.setRefreshTransientBuildOnPSS(true);
621             myfacesConfig.setRefreshTransientBuildOnPSSAuto(true);
622         }
623         else if (refreshTransientBuildOnPSS.equalsIgnoreCase("true") || 
624                 refreshTransientBuildOnPSS.equalsIgnoreCase("on") || 
625                 refreshTransientBuildOnPSS.equalsIgnoreCase("yes"))
626         {
627             myfacesConfig.setRefreshTransientBuildOnPSS(true);
628             myfacesConfig.setRefreshTransientBuildOnPSSAuto(false);
629         }
630         else
631         {
632             myfacesConfig.setRefreshTransientBuildOnPSS(false);
633             myfacesConfig.setRefreshTransientBuildOnPSSAuto(false);
634         }
635         
636         myfacesConfig.setRefreshTransientBuildOnPSSPreserveState(getBooleanInitParameter(extCtx,
637                 INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE, 
638                 INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT));
639         
640         myfacesConfig.setValidateXML(getBooleanInitParameter(extCtx, INIT_PARAM_VALIDATE_XML, 
641                 INIT_PARAM_VALIDATE_XML_DEFAULT));
642         
643         myfacesConfig.setWrapScriptContentWithXmlCommentTag(getBooleanInitParameter(extCtx, 
644                 INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG, 
645                 INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT));
646         
647         myfacesConfig.setDebugPhaseListenerEnabled(getBooleanInitParameter(extCtx, INIT_PARAM_DEBUG_PHASE_LISTENER,
648                 INIT_PARAM_DEBUG_PHASE_LISTENER_DEFAULT));
649         
650         myfacesConfig.setStrictJsf2RefreshTargetAjax(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
651                 INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX, INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX_DEFAULT));
652         
653         myfacesConfig.setStrictJsf2CCELResolver(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
654                 INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER, INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT));
655         
656         myfacesConfig.setDefaultResponseWriterContentTypeMode(WebConfigParamUtils.getStringInitParameter(
657                 extCtx, INIT_PARAM_DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE,
658                 INIT_PARAM_DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT));
659 
660         myfacesConfig.setViewUniqueIdsCacheEnabled(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
661                 INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED, INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT));
662         myfacesConfig.setComponentUniqueIdsCacheSize(
663                 WebConfigParamUtils.getIntegerInitParameter(extCtx,
664                 INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE, 
665                 INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT));
666         myfacesConfig.setSupportJSPAndFacesEL(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
667                 INIT_PARAM_SUPPORT_JSP_AND_FACES_EL, INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT));
668         
669         myfacesConfig.setGaeJsfJarFiles(WebConfigParamUtils.getStringInitParameter(extCtx, 
670                 INIT_PARAM_GAE_JSF_JAR_FILES, INIT_PARAM_GAE_JSF_JAR_FILES_DEFAULT));
671         myfacesConfig.setGaeJsfAnnotationsJarFiles(WebConfigParamUtils.getStringInitParameter(extCtx, 
672                 INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES, INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES_DEFAULT));
673 
674         myfacesConfig.setStrictJsf2ViewNotFound(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
675                 INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND, INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT));
676         
677         if (TOMAHAWK_AVAILABLE)
678         {
679             myfacesConfig.setDetectJavascript(getBooleanInitParameter(extCtx, INIT_PARAM_DETECT_JAVASCRIPT,
680                     INIT_PARAM_DETECT_JAVASCRIPT_DEFAULT));
681             myfacesConfig.setAutoScroll(getBooleanInitParameter(extCtx, INIT_PARAM_AUTO_SCROLL,
682                     INIT_PARAM_AUTO_SCROLL_DEFAULT));
683                         
684             myfacesConfig.setAddResourceClass(getStringInitParameter(extCtx, INIT_PARAM_ADD_RESOURCE_CLASS,
685                     INIT_PARAM_ADD_RESOURCE_CLASS_DEFAULT));
686             myfacesConfig.setResourceVirtualPath(getStringInitParameter(extCtx, INIT_PARAM_RESOURCE_VIRTUAL_PATH,
687                     INIT_PARAM_RESOURCE_VIRTUAL_PATH_DEFAULT));
688 
689             myfacesConfig.setCheckExtensionsFilter(getBooleanInitParameter(extCtx, INIT_CHECK_EXTENSIONS_FILTER,
690                     INIT_CHECK_EXTENSIONS_FILTER_DEFAULT));
691             /*
692             if(RI_IMPL_AVAILABLE)
693             {
694                 if(log.isLoggable(Level.INFO))
695                 {
696                     log.info("Starting up Tomahawk on the RI-JSF-Implementation.");
697                 }
698             }
699 
700             if(MYFACES_IMPL_AVAILABLE)
701             {
702                 if(log.isLoggable(Level.INFO))
703                 {
704                     log.info("Starting up Tomahawk on the MyFaces-JSF-Implementation");
705                 }
706             }*/
707         }
708         /*
709         else
710         {
711             if (log.isLoggable(Level.INFO))
712             {
713                 log.info("Tomahawk jar not available. Autoscrolling, DetectJavascript, "+
714                 "AddResourceClass and CheckExtensionsFilter are disabled now.");
715             }
716         }*/
717 
718         /*
719         if(RI_IMPL_AVAILABLE && MYFACES_IMPL_AVAILABLE)
720         {
721             log.severe("Both MyFaces and the RI are on your classpath. Please make sure to"+
722             " use only one of the two JSF-implementations.");
723         }*/
724         return myfacesConfig;
725     }
726 
727     private static boolean getBooleanInitParameter(ExternalContext externalContext,
728                                                    String paramName,
729                                                    boolean defaultValue)
730     {
731         String strValue = externalContext.getInitParameter(paramName);
732         if (strValue == null)
733         {
734             //if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" + 
735             // paramName + "' found, using default value " + defaultValue);
736             return defaultValue;
737         }
738         else if (strValue.equalsIgnoreCase("true") || strValue.equalsIgnoreCase("on") || 
739                 strValue.equalsIgnoreCase("yes"))
740         {
741             return true;
742         }
743         else if (strValue.equalsIgnoreCase("false") || strValue.equalsIgnoreCase("off") || 
744                 strValue.equalsIgnoreCase("no"))
745         {
746             return false;
747         }
748         else
749         {
750             //if (log.isLoggable(Level.WARNING)) log.warning("Wrong context init parameter '" + 
751             //paramName + "' (='" + strValue + "'), using default value " + defaultValue);
752             return defaultValue;
753         }
754     }
755 
756     private static String getStringInitParameter(ExternalContext externalContext,
757                                                  String paramName,
758                                                  String defaultValue)
759     {
760         String strValue = externalContext.getInitParameter(paramName);
761         if (strValue == null)
762         {
763             //if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" + paramName +
764             //"' found, using default value " + defaultValue); //defaultValue==null should not be 
765             //a problem here
766             return defaultValue;
767         }
768         
769         return strValue;
770     }
771 
772     private static long getLongInitParameter(ExternalContext externalContext,
773                                                   String paramName,
774                                                   long defaultValue)
775     {
776        String strValue = externalContext.getInitParameter(paramName);
777        if (strValue == null)
778        {
779            //if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" +paramName +
780            //"' found, using default value " +defaultValue);
781            return defaultValue;
782        }
783        else
784        {
785            try
786            {
787                return Long.parseLong(strValue);
788            }
789            catch (NumberFormatException e)
790            {
791                //if (log.isLoggable(Level.WARNING)) log.warning("Wrong context init parameter '" +
792                //paramName + "' (='" + strValue + "'), using default value " + defaultValue);
793            }
794            return defaultValue;
795        }
796     }
797         
798      private void setResourceVirtualPath( String resourceVirtualPath )
799      {
800          this._resourceVirtualPath = resourceVirtualPath;
801     }
802 
803      public String getResourceVirtualPath()
804      {
805          return this._resourceVirtualPath;
806      }
807 
808     public boolean isPrettyHtml()
809     {
810         return _prettyHtml;
811     }
812 
813     private void setPrettyHtml(boolean prettyHtml)
814     {
815         _prettyHtml = prettyHtml;
816     }
817 
818     public boolean isDetectJavascript()
819     {
820         return _detectJavascript;
821     }
822 
823     private void setDetectJavascript(boolean detectJavascript)
824     {
825         _detectJavascript = detectJavascript;
826     }
827 
828     private void setReadonlyAsDisabledForSelect(boolean readonlyAsDisabledForSelect)
829     {
830         _readonlyAsDisabledForSelect = readonlyAsDisabledForSelect;
831     }
832 
833     public boolean isReadonlyAsDisabledForSelect()
834     {
835         return _readonlyAsDisabledForSelect;
836     }
837 
838 
839    public long getConfigRefreshPeriod()
840    {
841        return _configRefreshPeriod;
842    }
843 
844    public void setConfigRefreshPeriod(long configRefreshPeriod)
845    {
846        _configRefreshPeriod = configRefreshPeriod;
847    }
848 
849     /**
850      * JSF API 1.2 defines a "javax.faces.ViewState" client parameter, that must be rendered as both the "name"
851      * and the "id" attribute of the hidden input that is rendered for the purpose of state saving
852      * (see ResponseStateManager.VIEW_STATE_PARAM).
853      * Actually this causes duplicate id attributes and thus invalid XHTML pages when multiple forms are rendered on
854      * one page. With the {@link #INIT_PARAM_RENDER_VIEWSTATE_ID} context parameter you can tune this behaviour.
855      * <br/>Set it to
856      * <ul><li>true - to render JSF 1.2 compliant id attributes (that might cause invalid XHTML), or</li>
857      * <li>false - to omit rendering of the id attribute (which is only needed for very special AJAX/Javascript 
858      * components)</li></ul>
859      * Default value is: true (for backwards compatibility and JSF 1.2 compliancy) 
860      * @return true, if the client state hidden input "javax.faces.ViewState" id attribute should be rendered
861      */
862     public boolean isRenderViewStateId()
863     {
864         return _renderViewStateId;
865     }
866 
867     public void setRenderViewStateId(boolean renderViewStateId)
868     {
869         _renderViewStateId = renderViewStateId;
870     }
871 
872     /**
873      * <p>W3C recommends to use the "&amp;amp;" entity instead of a plain "&amp;" character within HTML.
874      * This also applies to attribute values and thus to the "href" attribute of &lt;a&gt; elements as well.
875      * Even more, when XHTML is used as output the usage of plain "&amp;" characters is forbidden and would lead to
876      * invalid XML code.
877      * Therefore, since version 1.1.6 MyFaces renders the correct "&amp;amp;" entity for links.</p>
878      * <p>The init parameter
879      * {@link #INIT_PARAM_STRICT_XHTML_LINKS} makes it possible to restore the old behaviour and to make MyFaces
880      * "bug compatible" to the Sun RI which renders plain "&amp;" chars in links as well.</p>
881      * @see <a href="http://www.w3.org/TR/html401/charset.html#h-5.3.2">HTML 4.01 Specification</a>
882      * @see <a href="http://issues.apache.org/jira/browse/MYFACES-1774">Jira: MYFACES-1774</a>
883      * @return true if ampersand characters ("&amp;") should be correctly rendered as "&amp;amp;" entities 
884      *         within link urls (=default), false for old (XHTML incompatible) behaviour
885      */
886     public boolean isStrictXhtmlLinks()
887     {
888         return _strictXhtmlLinks;
889     }
890 
891     public void setStrictXhtmlLinks(boolean strictXhtmlLinks)
892     {
893         _strictXhtmlLinks = strictXhtmlLinks;
894     }
895 
896     public boolean isTomahawkAvailable()
897     {
898         return TOMAHAWK_AVAILABLE;
899     }
900 
901     public boolean isMyfacesImplAvailable()
902     {
903         return MYFACES_IMPL_AVAILABLE;
904     }
905 
906     public boolean isRiImplAvailable()
907     {
908         return RI_IMPL_AVAILABLE;
909     }
910 
911     /**
912      * Do not use this in renderers directly!
913      * You should use {@link org.apache.myfaces.shared.renderkit.html.util.JavascriptUtils#isJavascriptAllowed}
914      * to determine if javascript is allowed or not.
915      */
916     public boolean isAllowJavascript()
917     {
918         return _allowJavascript;
919     }
920 
921     private void setAllowJavascript(boolean allowJavascript)
922     {
923         _allowJavascript = allowJavascript;
924     }
925 
926     public boolean isAutoScroll()
927     {
928         return _autoScroll;
929     }
930 
931     private void setAutoScroll(boolean autoScroll)
932     {
933         _autoScroll = autoScroll;
934     }
935 
936     private void setAddResourceClass(String addResourceClass)
937     {
938         _addResourceClass = addResourceClass;
939     }
940 
941     public String getAddResourceClass()
942     {
943         return _addResourceClass;
944     }
945 
946     /**
947      * ExtensionFilter needs access to AddResourceClass init param without having
948      * an ExternalContext at hand.
949      */
950     public static String getAddResourceClassFromServletContext(ServletContext servletContext)
951     {
952         String addResourceClass = servletContext.getInitParameter(INIT_PARAM_ADD_RESOURCE_CLASS);
953 
954         return addResourceClass == null ? INIT_PARAM_ADD_RESOURCE_CLASS_DEFAULT : addResourceClass;
955     }
956 
957     /**
958      * Should the environment be checked so that the ExtensionsFilter will work properly. 
959      */
960     public boolean isCheckExtensionsFilter()
961     {
962         return _checkExtensionsFilter;
963     }
964 
965     public void setCheckExtensionsFilter(boolean extensionsFilter)
966     {
967         _checkExtensionsFilter = extensionsFilter;
968     }
969 
970     /**
971      * 
972      */
973     public boolean isViewStateJavascript()
974     {
975         return _viewStateJavascript;
976     }
977 
978     private void setViewStateJavascript(boolean viewStateJavascript)
979     {
980         _viewStateJavascript = viewStateJavascript;
981     }
982 
983     public void setRenderClearJavascriptOnButton(
984             boolean renderClearJavascriptOnButton)
985     {
986         _renderClearJavascriptOnButton = renderClearJavascriptOnButton;
987     }
988 
989     /**
990      * This param renders the clear javascript on button necessary only for
991      * compatibility with hidden fields feature of myfaces. This is done 
992      * because jsf ri does not render javascript on onclick method for button,
993      * so myfaces should do this.
994      * 
995      * @return
996      */
997     public boolean isRenderClearJavascriptOnButton()
998     {
999         return _renderClearJavascriptOnButton;
1000     }
1001 
1002     public boolean isRenderHiddenFieldsForLinkParams()
1003     {
1004         return renderHiddenFieldsForLinkParams;
1005     }
1006 
1007     public void setRenderHiddenFieldsForLinkParams(
1008             boolean renderHiddenFieldsForLinkParams)
1009     {
1010         this.renderHiddenFieldsForLinkParams = renderHiddenFieldsForLinkParams;
1011     }
1012 
1013     public void setSaveFormSubmitLinkIE(boolean saveFormSubmitLinkIE)
1014     {
1015         _saveFormSubmitLinkIE = saveFormSubmitLinkIE;
1016     }
1017 
1018     /**
1019      * Add a code that save the form when submit a form using a
1020      * link. It's a bug on IE.
1021      * 
1022      * @return
1023      */
1024     public boolean isSaveFormSubmitLinkIE()
1025     {
1026         return _saveFormSubmitLinkIE;
1027     }
1028     
1029     public String getDelegateFacesServlet()
1030     {
1031         return _delegateFacesServlet;
1032     }
1033     
1034     public void setDelegateFacesServlet(String delegateFacesServlet)
1035     {
1036         _delegateFacesServlet = delegateFacesServlet;
1037     }
1038 
1039     public boolean isRefreshTransientBuildOnPSS()
1040     {
1041         return _refreshTransientBuildOnPSS;
1042     }
1043 
1044     public void setRefreshTransientBuildOnPSS(boolean refreshTransientBuildOnPSS)
1045     {
1046         this._refreshTransientBuildOnPSS = refreshTransientBuildOnPSS;
1047     }
1048 
1049     public boolean isRefreshTransientBuildOnPSSAuto()
1050     {
1051         return _refreshTransientBuildOnPSSAuto;
1052     }
1053 
1054     public void setRefreshTransientBuildOnPSSAuto(
1055             boolean refreshTransientBuildOnPSSAuto)
1056     {
1057         this._refreshTransientBuildOnPSSAuto = refreshTransientBuildOnPSSAuto;
1058     }
1059 
1060     public boolean isRefreshTransientBuildOnPSSPreserveState()
1061     {
1062         return refreshTransientBuildOnPSSPreserveState;
1063     }
1064 
1065     public void setRefreshTransientBuildOnPSSPreserveState(
1066             boolean refreshTransientBuildOnPSSPreserveState)
1067     {
1068         this.refreshTransientBuildOnPSSPreserveState = refreshTransientBuildOnPSSPreserveState;
1069     }
1070     
1071     public boolean isValidateXML()
1072     {
1073         return _validateXML;
1074     }
1075 
1076     public void setValidateXML(boolean validateXML)
1077     {
1078         _validateXML = validateXML;
1079     }
1080 
1081     public boolean isWrapScriptContentWithXmlCommentTag()
1082     {
1083         return _wrapScriptContentWithXmlCommentTag;
1084     }
1085 
1086     public void setWrapScriptContentWithXmlCommentTag(
1087             boolean wrapScriptContentWithXmlCommentTag)
1088     {
1089         this._wrapScriptContentWithXmlCommentTag = wrapScriptContentWithXmlCommentTag;
1090     }
1091 
1092     public boolean isRenderFormSubmitScriptInline()
1093     {
1094         return _renderFormSubmitScriptInline;
1095     }
1096 
1097     public void setRenderFormSubmitScriptInline(
1098             boolean renderFormSubmitScriptInline)
1099     {
1100         _renderFormSubmitScriptInline = renderFormSubmitScriptInline;
1101     }
1102 
1103     public boolean isDebugPhaseListenerEnabled()
1104     {
1105         return _debugPhaseListenerEnabled;
1106     }
1107 
1108     public void setDebugPhaseListenerEnabled(boolean debugPhaseListener)
1109     {
1110         this._debugPhaseListenerEnabled = debugPhaseListener;
1111     }
1112 
1113     public boolean isStrictJsf2RefreshTargetAjax()
1114     {
1115         return _strictJsf2RefreshTargetAjax;
1116     }
1117 
1118     public void setStrictJsf2RefreshTargetAjax(boolean strictJsf2RefreshTargetAjax)
1119     {
1120         this._strictJsf2RefreshTargetAjax = strictJsf2RefreshTargetAjax;
1121     }
1122 
1123     public boolean isStrictJsf2CCELResolver()
1124     {
1125         return _strictJsf2CCELResolver;
1126     }
1127 
1128     public void setStrictJsf2CCELResolver(boolean strictJsf2CCELResolver)
1129     {
1130         this._strictJsf2CCELResolver = strictJsf2CCELResolver;
1131     }
1132 
1133     public String getDefaultResponseWriterContentTypeMode()
1134     {
1135         return _defaultResponseWriterContentTypeMode;
1136     }
1137 
1138     public void setDefaultResponseWriterContentTypeMode(
1139             String defaultResponseWriterContentTypeMode)
1140     {
1141         this._defaultResponseWriterContentTypeMode = defaultResponseWriterContentTypeMode;
1142     }
1143 
1144     public boolean isViewUniqueIdsCacheEnabled()
1145     {
1146         return _viewUniqueIdsCacheEnabled;
1147     }
1148 
1149     public void setViewUniqueIdsCacheEnabled(boolean viewUniqueIdsCacheEnabled)
1150     {
1151         _viewUniqueIdsCacheEnabled = viewUniqueIdsCacheEnabled;
1152     }
1153 
1154     public boolean isSupportJSPAndFacesEL()
1155     {
1156         return _supportJSPAndFacesEL;
1157     }
1158 
1159     public void setSupportJSPAndFacesEL(
1160             boolean supportJSPANDFacesEL)
1161     {
1162         _supportJSPAndFacesEL = supportJSPANDFacesEL;
1163     }
1164 
1165     public int getComponentUniqueIdsCacheSize()
1166     {
1167         return _componentUniqueIdsCacheSize;
1168     }
1169 
1170     public void setComponentUniqueIdsCacheSize(int componentUniqueIdsCacheSize)
1171     {
1172         this._componentUniqueIdsCacheSize = componentUniqueIdsCacheSize;
1173     }
1174 
1175     public String getGaeJsfJarFiles()
1176     {
1177         return _gaeJsfJarFiles;
1178     }
1179 
1180     public void setGaeJsfJarFiles(String gaeJsfJarFiles)
1181     {
1182         this._gaeJsfJarFiles = gaeJsfJarFiles;
1183     }
1184 
1185     public String getGaeJsfAnnotationsJarFiles()
1186     {
1187         return _gaeJsfAnnotationsJarFiles;
1188     }
1189 
1190     public void setGaeJsfAnnotationsJarFiles(String gaeJsfAnnotationsJarFiles)
1191     {
1192         this._gaeJsfAnnotationsJarFiles = gaeJsfAnnotationsJarFiles;
1193     }
1194 
1195     public boolean isStrictJsf2ViewNotFound()
1196     {
1197         return _strictJsf2ViewNotFound;
1198     }
1199 
1200     public void setStrictJsf2ViewNotFound(boolean strictJsf2ViewNotFound)
1201     {
1202         this._strictJsf2ViewNotFound = strictJsf2ViewNotFound;
1203     }
1204 }