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: 1297563 $ $Date: 2012-03-06 11:28:55 -0500 (Tue, 06 Mar 2012) $
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     private boolean _prettyHtml;
394     private boolean _detectJavascript;
395     private boolean _allowJavascript;
396     private boolean _autoScroll;
397     private String _addResourceClass;
398     private String _resourceVirtualPath;
399     private boolean _checkExtensionsFilter;
400     private boolean _readonlyAsDisabledForSelect;
401     private long _configRefreshPeriod;
402     private boolean _viewStateJavascript;
403     private boolean _renderViewStateId;
404     private boolean _strictXhtmlLinks;
405     private boolean _renderClearJavascriptOnButton;
406     private boolean renderHiddenFieldsForLinkParams;
407     private boolean _saveFormSubmitLinkIE;
408     private String _delegateFacesServlet;
409     private boolean _refreshTransientBuildOnPSS;
410     private boolean _refreshTransientBuildOnPSSAuto;
411     private boolean refreshTransientBuildOnPSSPreserveState;
412     private boolean _validateXML;
413     private boolean _wrapScriptContentWithXmlCommentTag;
414     private boolean _renderFormSubmitScriptInline;
415     private boolean _debugPhaseListenerEnabled;
416     private boolean _strictJsf2RefreshTargetAjax;
417     private boolean _strictJsf2CCELResolver;
418     private String _defaultResponseWriterContentTypeMode;
419     private boolean _viewUniqueIdsCacheEnabled;
420     private int _componentUniqueIdsCacheSize;
421     private boolean _supportJSPAndFacesEL;
422 
423     private static final boolean TOMAHAWK_AVAILABLE;
424     private static final boolean MYFACES_IMPL_AVAILABLE;
425     private static final boolean RI_IMPL_AVAILABLE;
426 
427     static
428     {
429         boolean tomahawkAvailable;
430         try
431         {
432             ClassUtils.classForName("org.apache.myfaces.webapp.filter.ExtensionsFilter");
433             tomahawkAvailable = true;
434         }
435         catch (ClassNotFoundException e)
436         {
437             tomahawkAvailable = false;
438         }
439         TOMAHAWK_AVAILABLE = tomahawkAvailable;
440     }
441 
442     static
443     {
444         boolean myfacesImplAvailable;
445         try
446         {
447             ClassUtils.classForName("org.apache.myfaces.application.ApplicationImpl");
448             myfacesImplAvailable = true;
449         }
450         catch (ClassNotFoundException e)
451         {
452             myfacesImplAvailable = false;
453         }
454         MYFACES_IMPL_AVAILABLE = myfacesImplAvailable;
455     }
456 
457     static
458     {
459         boolean riImplAvailable;
460         try
461         {
462             ClassUtils.classForName("com.sun.faces.application.ApplicationImpl");
463             riImplAvailable = true;
464         }
465         catch (ClassNotFoundException e)
466         {
467             riImplAvailable = false;
468         }
469         RI_IMPL_AVAILABLE = riImplAvailable;
470     }
471 
472     public static MyfacesConfig getCurrentInstance(ExternalContext extCtx)
473     {
474         MyfacesConfig myfacesConfig = (MyfacesConfig) extCtx
475                 .getApplicationMap().get(APPLICATION_MAP_PARAM_NAME);
476         if (myfacesConfig == null)
477         {
478 
479             myfacesConfig = createAndInitializeMyFacesConfig(extCtx);
480 
481             extCtx.getApplicationMap().put(APPLICATION_MAP_PARAM_NAME, myfacesConfig);
482 
483         }
484 
485         return myfacesConfig;
486     }
487     
488     public MyfacesConfig()
489     {
490         setPrettyHtml(INIT_PARAM_PRETTY_HTML_DEFAULT);
491         setAllowJavascript(INIT_PARAM_ALLOW_JAVASCRIPT_DEFAULT);
492         setRenderClearJavascriptOnButton(INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT);
493         setRenderHiddenFieldsForLinkParams(INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS_DEFAULT);
494         setSaveFormSubmitLinkIE(INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE_DEFAULT);
495         setReadonlyAsDisabledForSelect(INIT_READONLY_AS_DISABLED_FOR_SELECT_DEFAULT);
496         setRenderViewStateId(INIT_PARAM_RENDER_VIEWSTATE_ID_DEFAULT);
497         setStrictXhtmlLinks(INIT_PARAM_STRICT_XHTML_LINKS_DEFAULT);
498         setConfigRefreshPeriod(INIT_PARAM_CONFIG_REFRESH_PERIOD_DEFAULT);        
499         setViewStateJavascript(INIT_PARAM_VIEWSTATE_JAVASCRIPT_DEFAULT);        
500         setRefreshTransientBuildOnPSS(true);
501         setRefreshTransientBuildOnPSSAuto(true);
502         setRefreshTransientBuildOnPSSPreserveState(INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT);
503         setValidateXML(INIT_PARAM_VALIDATE_XML_DEFAULT);
504         setWrapScriptContentWithXmlCommentTag(INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT);
505         setDetectJavascript(INIT_PARAM_DETECT_JAVASCRIPT_DEFAULT);
506         setAutoScroll(INIT_PARAM_AUTO_SCROLL_DEFAULT);
507         setAddResourceClass(INIT_PARAM_ADD_RESOURCE_CLASS_DEFAULT);
508         setResourceVirtualPath(INIT_PARAM_RESOURCE_VIRTUAL_PATH_DEFAULT);
509         //The default is true but we'll let it false because it depends if 
510         //tomahawk is on classpath and no test environment is set
511         setCheckExtensionsFilter(false);
512         setRenderFormSubmitScriptInline(INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_DEFAULT);
513         setDebugPhaseListenerEnabled(INIT_PARAM_DEBUG_PHASE_LISTENER_DEFAULT);
514         setStrictJsf2RefreshTargetAjax(INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX_DEFAULT);
515         setStrictJsf2CCELResolver(INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT);
516         setDefaultResponseWriterContentTypeMode(INIT_PARAM_DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT);
517         setViewUniqueIdsCacheEnabled(INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT);
518         setComponentUniqueIdsCacheSize(INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT);
519         setSupportJSPAndFacesEL(INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT);
520     }
521 
522     private static MyfacesConfig createAndInitializeMyFacesConfig(ExternalContext extCtx)
523     {
524         
525         MyfacesConfig myfacesConfig = new MyfacesConfig();
526 
527         myfacesConfig.setPrettyHtml(getBooleanInitParameter(extCtx, INIT_PARAM_PRETTY_HTML,
528                                                             INIT_PARAM_PRETTY_HTML_DEFAULT));
529         myfacesConfig.setAllowJavascript(getBooleanInitParameter(extCtx, INIT_PARAM_ALLOW_JAVASCRIPT,
530                                                                  INIT_PARAM_ALLOW_JAVASCRIPT_DEFAULT));
531 
532         myfacesConfig.setRenderClearJavascriptOnButton(getBooleanInitParameter(extCtx, 
533                                                             INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON,
534                                                             INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT));
535 
536         myfacesConfig.setRenderHiddenFieldsForLinkParams(getBooleanInitParameter(extCtx, 
537                 INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS,
538                 INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS_DEFAULT));
539 
540         myfacesConfig.setSaveFormSubmitLinkIE(getBooleanInitParameter(extCtx, INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE,
541                                                             INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE_DEFAULT));
542         
543         myfacesConfig.setReadonlyAsDisabledForSelect(getBooleanInitParameter(extCtx, 
544                                                                  INIT_READONLY_AS_DISABLED_FOR_SELECT,
545                                                                  INIT_READONLY_AS_DISABLED_FOR_SELECT_DEFAULT));
546         myfacesConfig.setRenderViewStateId(getBooleanInitParameter(extCtx, INIT_PARAM_RENDER_VIEWSTATE_ID,
547                                                                    INIT_PARAM_RENDER_VIEWSTATE_ID_DEFAULT));
548         myfacesConfig.setStrictXhtmlLinks(getBooleanInitParameter(extCtx, INIT_PARAM_STRICT_XHTML_LINKS,
549                                                                   INIT_PARAM_STRICT_XHTML_LINKS_DEFAULT));
550         myfacesConfig.setRenderFormSubmitScriptInline(getBooleanInitParameter(extCtx,
551                                                                   INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE,
552                                                                   INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_DEFAULT));
553         
554         myfacesConfig.setConfigRefreshPeriod(getLongInitParameter(extCtx, INIT_PARAM_CONFIG_REFRESH_PERIOD,
555                 INIT_PARAM_CONFIG_REFRESH_PERIOD_DEFAULT));
556 
557         myfacesConfig.setViewStateJavascript(getBooleanInitParameter(extCtx, INIT_PARAM_VIEWSTATE_JAVASCRIPT,
558                 INIT_PARAM_VIEWSTATE_JAVASCRIPT_DEFAULT));
559 
560         myfacesConfig.setDelegateFacesServlet(extCtx.getInitParameter(INIT_PARAM_DELEGATE_FACES_SERVLET));
561         
562         String refreshTransientBuildOnPSS = getStringInitParameter(extCtx, 
563                 INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS, 
564                 INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT);
565         
566         if (refreshTransientBuildOnPSS == null)
567         {
568             myfacesConfig.setRefreshTransientBuildOnPSS(false);
569             myfacesConfig.setRefreshTransientBuildOnPSSAuto(false);
570         }
571         else if ("auto".equalsIgnoreCase(refreshTransientBuildOnPSS))
572         {
573             myfacesConfig.setRefreshTransientBuildOnPSS(true);
574             myfacesConfig.setRefreshTransientBuildOnPSSAuto(true);
575         }
576         else if (refreshTransientBuildOnPSS.equalsIgnoreCase("true") || 
577                 refreshTransientBuildOnPSS.equalsIgnoreCase("on") || 
578                 refreshTransientBuildOnPSS.equalsIgnoreCase("yes"))
579         {
580             myfacesConfig.setRefreshTransientBuildOnPSS(true);
581             myfacesConfig.setRefreshTransientBuildOnPSSAuto(false);
582         }
583         else
584         {
585             myfacesConfig.setRefreshTransientBuildOnPSS(false);
586             myfacesConfig.setRefreshTransientBuildOnPSSAuto(false);
587         }
588         
589         myfacesConfig.setRefreshTransientBuildOnPSSPreserveState(getBooleanInitParameter(extCtx,
590                 INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE, 
591                 INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT));
592         
593         myfacesConfig.setValidateXML(getBooleanInitParameter(extCtx, INIT_PARAM_VALIDATE_XML, 
594                 INIT_PARAM_VALIDATE_XML_DEFAULT));
595         
596         myfacesConfig.setWrapScriptContentWithXmlCommentTag(getBooleanInitParameter(extCtx, 
597                 INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG, 
598                 INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT));
599         
600         myfacesConfig.setDebugPhaseListenerEnabled(getBooleanInitParameter(extCtx, INIT_PARAM_DEBUG_PHASE_LISTENER,
601                 INIT_PARAM_DEBUG_PHASE_LISTENER_DEFAULT));
602         
603         myfacesConfig.setStrictJsf2RefreshTargetAjax(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
604                 INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX, INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX_DEFAULT));
605         
606         myfacesConfig.setStrictJsf2CCELResolver(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
607                 INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER, INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT));
608         
609         myfacesConfig.setDefaultResponseWriterContentTypeMode(WebConfigParamUtils.getStringInitParameter(
610                 extCtx, INIT_PARAM_DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE,
611                 INIT_PARAM_DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT));
612 
613         myfacesConfig.setViewUniqueIdsCacheEnabled(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
614                 INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED, INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT));
615         myfacesConfig.setComponentUniqueIdsCacheSize(
616                 WebConfigParamUtils.getIntegerInitParameter(extCtx,
617                 INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE, 
618                 INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT));
619         myfacesConfig.setSupportJSPAndFacesEL(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
620                 INIT_PARAM_SUPPORT_JSP_AND_FACES_EL, INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT));
621         
622         if (TOMAHAWK_AVAILABLE)
623         {
624             myfacesConfig.setDetectJavascript(getBooleanInitParameter(extCtx, INIT_PARAM_DETECT_JAVASCRIPT,
625                     INIT_PARAM_DETECT_JAVASCRIPT_DEFAULT));
626             myfacesConfig.setAutoScroll(getBooleanInitParameter(extCtx, INIT_PARAM_AUTO_SCROLL,
627                     INIT_PARAM_AUTO_SCROLL_DEFAULT));
628                         
629             myfacesConfig.setAddResourceClass(getStringInitParameter(extCtx, INIT_PARAM_ADD_RESOURCE_CLASS,
630                     INIT_PARAM_ADD_RESOURCE_CLASS_DEFAULT));
631             myfacesConfig.setResourceVirtualPath(getStringInitParameter(extCtx, INIT_PARAM_RESOURCE_VIRTUAL_PATH,
632                     INIT_PARAM_RESOURCE_VIRTUAL_PATH_DEFAULT));
633 
634             myfacesConfig.setCheckExtensionsFilter(getBooleanInitParameter(extCtx, INIT_CHECK_EXTENSIONS_FILTER,
635                     INIT_CHECK_EXTENSIONS_FILTER_DEFAULT));
636             /*
637             if(RI_IMPL_AVAILABLE)
638             {
639                 if(log.isLoggable(Level.INFO))
640                 {
641                     log.info("Starting up Tomahawk on the RI-JSF-Implementation.");
642                 }
643             }
644 
645             if(MYFACES_IMPL_AVAILABLE)
646             {
647                 if(log.isLoggable(Level.INFO))
648                 {
649                     log.info("Starting up Tomahawk on the MyFaces-JSF-Implementation");
650                 }
651             }*/
652         }
653         /*
654         else
655         {
656             if (log.isLoggable(Level.INFO))
657             {
658                 log.info("Tomahawk jar not available. Autoscrolling, DetectJavascript, "+
659                 "AddResourceClass and CheckExtensionsFilter are disabled now.");
660             }
661         }*/
662 
663         /*
664         if(RI_IMPL_AVAILABLE && MYFACES_IMPL_AVAILABLE)
665         {
666             log.severe("Both MyFaces and the RI are on your classpath. Please make sure to"+
667             " use only one of the two JSF-implementations.");
668         }*/
669         return myfacesConfig;
670     }
671 
672     private static boolean getBooleanInitParameter(ExternalContext externalContext,
673                                                    String paramName,
674                                                    boolean defaultValue)
675     {
676         String strValue = externalContext.getInitParameter(paramName);
677         if (strValue == null)
678         {
679             //if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" + 
680             // paramName + "' found, using default value " + defaultValue);
681             return defaultValue;
682         }
683         else if (strValue.equalsIgnoreCase("true") || strValue.equalsIgnoreCase("on") || 
684                 strValue.equalsIgnoreCase("yes"))
685         {
686             return true;
687         }
688         else if (strValue.equalsIgnoreCase("false") || strValue.equalsIgnoreCase("off") || 
689                 strValue.equalsIgnoreCase("no"))
690         {
691             return false;
692         }
693         else
694         {
695             //if (log.isLoggable(Level.WARNING)) log.warning("Wrong context init parameter '" + 
696             //paramName + "' (='" + strValue + "'), using default value " + defaultValue);
697             return defaultValue;
698         }
699     }
700 
701     private static String getStringInitParameter(ExternalContext externalContext,
702                                                  String paramName,
703                                                  String defaultValue)
704     {
705         String strValue = externalContext.getInitParameter(paramName);
706         if (strValue == null)
707         {
708             //if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" + paramName +
709             //"' found, using default value " + defaultValue); //defaultValue==null should not be 
710             //a problem here
711             return defaultValue;
712         }
713         
714         return strValue;
715     }
716 
717     private static long getLongInitParameter(ExternalContext externalContext,
718                                                   String paramName,
719                                                   long defaultValue)
720     {
721        String strValue = externalContext.getInitParameter(paramName);
722        if (strValue == null)
723        {
724            //if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" +paramName +
725            //"' found, using default value " +defaultValue);
726            return defaultValue;
727        }
728        else
729        {
730            try
731            {
732                return Long.parseLong(strValue);
733            }
734            catch (NumberFormatException e)
735            {
736                //if (log.isLoggable(Level.WARNING)) log.warning("Wrong context init parameter '" +
737                //paramName + "' (='" + strValue + "'), using default value " + defaultValue);
738            }
739            return defaultValue;
740        }
741     }
742         
743      private void setResourceVirtualPath( String resourceVirtualPath )
744      {
745          this._resourceVirtualPath = resourceVirtualPath;
746     }
747 
748      public String getResourceVirtualPath()
749      {
750          return this._resourceVirtualPath;
751      }
752 
753     public boolean isPrettyHtml()
754     {
755         return _prettyHtml;
756     }
757 
758     private void setPrettyHtml(boolean prettyHtml)
759     {
760         _prettyHtml = prettyHtml;
761     }
762 
763     public boolean isDetectJavascript()
764     {
765         return _detectJavascript;
766     }
767 
768     private void setDetectJavascript(boolean detectJavascript)
769     {
770         _detectJavascript = detectJavascript;
771     }
772 
773     private void setReadonlyAsDisabledForSelect(boolean readonlyAsDisabledForSelect)
774     {
775         _readonlyAsDisabledForSelect = readonlyAsDisabledForSelect;
776     }
777 
778     public boolean isReadonlyAsDisabledForSelect()
779     {
780         return _readonlyAsDisabledForSelect;
781     }
782 
783 
784    public long getConfigRefreshPeriod()
785    {
786        return _configRefreshPeriod;
787    }
788 
789    public void setConfigRefreshPeriod(long configRefreshPeriod)
790    {
791        _configRefreshPeriod = configRefreshPeriod;
792    }
793 
794     /**
795      * JSF API 1.2 defines a "javax.faces.ViewState" client parameter, that must be rendered as both the "name"
796      * and the "id" attribute of the hidden input that is rendered for the purpose of state saving
797      * (see ResponseStateManager.VIEW_STATE_PARAM).
798      * Actually this causes duplicate id attributes and thus invalid XHTML pages when multiple forms are rendered on
799      * one page. With the {@link #INIT_PARAM_RENDER_VIEWSTATE_ID} context parameter you can tune this behaviour.
800      * <br/>Set it to
801      * <ul><li>true - to render JSF 1.2 compliant id attributes (that might cause invalid XHTML), or</li>
802      * <li>false - to omit rendering of the id attribute (which is only needed for very special AJAX/Javascript 
803      * components)</li></ul>
804      * Default value is: true (for backwards compatibility and JSF 1.2 compliancy) 
805      * @return true, if the client state hidden input "javax.faces.ViewState" id attribute should be rendered
806      */
807     public boolean isRenderViewStateId()
808     {
809         return _renderViewStateId;
810     }
811 
812     public void setRenderViewStateId(boolean renderViewStateId)
813     {
814         _renderViewStateId = renderViewStateId;
815     }
816 
817     /**
818      * <p>W3C recommends to use the "&amp;amp;" entity instead of a plain "&amp;" character within HTML.
819      * This also applies to attribute values and thus to the "href" attribute of &lt;a&gt; elements as well.
820      * Even more, when XHTML is used as output the usage of plain "&amp;" characters is forbidden and would lead to
821      * invalid XML code.
822      * Therefore, since version 1.1.6 MyFaces renders the correct "&amp;amp;" entity for links.</p>
823      * <p>The init parameter
824      * {@link #INIT_PARAM_STRICT_XHTML_LINKS} makes it possible to restore the old behaviour and to make MyFaces
825      * "bug compatible" to the Sun RI which renders plain "&amp;" chars in links as well.</p>
826      * @see <a href="http://www.w3.org/TR/html401/charset.html#h-5.3.2">HTML 4.01 Specification</a>
827      * @see <a href="http://issues.apache.org/jira/browse/MYFACES-1774">Jira: MYFACES-1774</a>
828      * @return true if ampersand characters ("&amp;") should be correctly rendered as "&amp;amp;" entities 
829      *         within link urls (=default), false for old (XHTML incompatible) behaviour
830      */
831     public boolean isStrictXhtmlLinks()
832     {
833         return _strictXhtmlLinks;
834     }
835 
836     public void setStrictXhtmlLinks(boolean strictXhtmlLinks)
837     {
838         _strictXhtmlLinks = strictXhtmlLinks;
839     }
840 
841     public boolean isTomahawkAvailable()
842     {
843         return TOMAHAWK_AVAILABLE;
844     }
845 
846     public boolean isMyfacesImplAvailable()
847     {
848         return MYFACES_IMPL_AVAILABLE;
849     }
850 
851     public boolean isRiImplAvailable()
852     {
853         return RI_IMPL_AVAILABLE;
854     }
855 
856     /**
857      * Do not use this in renderers directly!
858      * You should use {@link org.apache.myfaces.shared.renderkit.html.util.JavascriptUtils#isJavascriptAllowed}
859      * to determine if javascript is allowed or not.
860      */
861     public boolean isAllowJavascript()
862     {
863         return _allowJavascript;
864     }
865 
866     private void setAllowJavascript(boolean allowJavascript)
867     {
868         _allowJavascript = allowJavascript;
869     }
870 
871     public boolean isAutoScroll()
872     {
873         return _autoScroll;
874     }
875 
876     private void setAutoScroll(boolean autoScroll)
877     {
878         _autoScroll = autoScroll;
879     }
880 
881     private void setAddResourceClass(String addResourceClass)
882     {
883         _addResourceClass = addResourceClass;
884     }
885 
886     public String getAddResourceClass()
887     {
888         return _addResourceClass;
889     }
890 
891     /**
892      * ExtensionFilter needs access to AddResourceClass init param without having
893      * an ExternalContext at hand.
894      */
895     public static String getAddResourceClassFromServletContext(ServletContext servletContext)
896     {
897         String addResourceClass = servletContext.getInitParameter(INIT_PARAM_ADD_RESOURCE_CLASS);
898 
899         return addResourceClass == null ? INIT_PARAM_ADD_RESOURCE_CLASS_DEFAULT : addResourceClass;
900     }
901 
902     /**
903      * Should the environment be checked so that the ExtensionsFilter will work properly. 
904      */
905     public boolean isCheckExtensionsFilter()
906     {
907         return _checkExtensionsFilter;
908     }
909 
910     public void setCheckExtensionsFilter(boolean extensionsFilter)
911     {
912         _checkExtensionsFilter = extensionsFilter;
913     }
914 
915     /**
916      * 
917      */
918     public boolean isViewStateJavascript()
919     {
920         return _viewStateJavascript;
921     }
922 
923     private void setViewStateJavascript(boolean viewStateJavascript)
924     {
925         _viewStateJavascript = viewStateJavascript;
926     }
927 
928     public void setRenderClearJavascriptOnButton(
929             boolean renderClearJavascriptOnButton)
930     {
931         _renderClearJavascriptOnButton = renderClearJavascriptOnButton;
932     }
933 
934     /**
935      * This param renders the clear javascript on button necessary only for
936      * compatibility with hidden fields feature of myfaces. This is done 
937      * because jsf ri does not render javascript on onclick method for button,
938      * so myfaces should do this.
939      * 
940      * @return
941      */
942     public boolean isRenderClearJavascriptOnButton()
943     {
944         return _renderClearJavascriptOnButton;
945     }
946 
947     public boolean isRenderHiddenFieldsForLinkParams()
948     {
949         return renderHiddenFieldsForLinkParams;
950     }
951 
952     public void setRenderHiddenFieldsForLinkParams(
953             boolean renderHiddenFieldsForLinkParams)
954     {
955         this.renderHiddenFieldsForLinkParams = renderHiddenFieldsForLinkParams;
956     }
957 
958     public void setSaveFormSubmitLinkIE(boolean saveFormSubmitLinkIE)
959     {
960         _saveFormSubmitLinkIE = saveFormSubmitLinkIE;
961     }
962 
963     /**
964      * Add a code that save the form when submit a form using a
965      * link. It's a bug on IE.
966      * 
967      * @return
968      */
969     public boolean isSaveFormSubmitLinkIE()
970     {
971         return _saveFormSubmitLinkIE;
972     }
973     
974     public String getDelegateFacesServlet()
975     {
976         return _delegateFacesServlet;
977     }
978     
979     public void setDelegateFacesServlet(String delegateFacesServlet)
980     {
981         _delegateFacesServlet = delegateFacesServlet;
982     }
983 
984     public boolean isRefreshTransientBuildOnPSS()
985     {
986         return _refreshTransientBuildOnPSS;
987     }
988 
989     public void setRefreshTransientBuildOnPSS(boolean refreshTransientBuildOnPSS)
990     {
991         this._refreshTransientBuildOnPSS = refreshTransientBuildOnPSS;
992     }
993 
994     public boolean isRefreshTransientBuildOnPSSAuto()
995     {
996         return _refreshTransientBuildOnPSSAuto;
997     }
998 
999     public void setRefreshTransientBuildOnPSSAuto(
1000             boolean refreshTransientBuildOnPSSAuto)
1001     {
1002         this._refreshTransientBuildOnPSSAuto = refreshTransientBuildOnPSSAuto;
1003     }
1004 
1005     public boolean isRefreshTransientBuildOnPSSPreserveState()
1006     {
1007         return refreshTransientBuildOnPSSPreserveState;
1008     }
1009 
1010     public void setRefreshTransientBuildOnPSSPreserveState(
1011             boolean refreshTransientBuildOnPSSPreserveState)
1012     {
1013         this.refreshTransientBuildOnPSSPreserveState = refreshTransientBuildOnPSSPreserveState;
1014     }
1015     
1016     public boolean isValidateXML()
1017     {
1018         return _validateXML;
1019     }
1020 
1021     public void setValidateXML(boolean validateXML)
1022     {
1023         _validateXML = validateXML;
1024     }
1025 
1026     public boolean isWrapScriptContentWithXmlCommentTag()
1027     {
1028         return _wrapScriptContentWithXmlCommentTag;
1029     }
1030 
1031     public void setWrapScriptContentWithXmlCommentTag(
1032             boolean wrapScriptContentWithXmlCommentTag)
1033     {
1034         this._wrapScriptContentWithXmlCommentTag = wrapScriptContentWithXmlCommentTag;
1035     }
1036 
1037     public boolean isRenderFormSubmitScriptInline()
1038     {
1039         return _renderFormSubmitScriptInline;
1040     }
1041 
1042     public void setRenderFormSubmitScriptInline(
1043             boolean renderFormSubmitScriptInline)
1044     {
1045         _renderFormSubmitScriptInline = renderFormSubmitScriptInline;
1046     }
1047 
1048     public boolean isDebugPhaseListenerEnabled()
1049     {
1050         return _debugPhaseListenerEnabled;
1051     }
1052 
1053     public void setDebugPhaseListenerEnabled(boolean debugPhaseListener)
1054     {
1055         this._debugPhaseListenerEnabled = debugPhaseListener;
1056     }
1057 
1058     public boolean isStrictJsf2RefreshTargetAjax()
1059     {
1060         return _strictJsf2RefreshTargetAjax;
1061     }
1062 
1063     public void setStrictJsf2RefreshTargetAjax(boolean strictJsf2RefreshTargetAjax)
1064     {
1065         this._strictJsf2RefreshTargetAjax = strictJsf2RefreshTargetAjax;
1066     }
1067 
1068     public boolean isStrictJsf2CCELResolver()
1069     {
1070         return _strictJsf2CCELResolver;
1071     }
1072 
1073     public void setStrictJsf2CCELResolver(boolean strictJsf2CCELResolver)
1074     {
1075         this._strictJsf2CCELResolver = strictJsf2CCELResolver;
1076     }
1077 
1078     public String getDefaultResponseWriterContentTypeMode()
1079     {
1080         return _defaultResponseWriterContentTypeMode;
1081     }
1082 
1083     public void setDefaultResponseWriterContentTypeMode(
1084             String defaultResponseWriterContentTypeMode)
1085     {
1086         this._defaultResponseWriterContentTypeMode = defaultResponseWriterContentTypeMode;
1087     }
1088 
1089     public boolean isViewUniqueIdsCacheEnabled()
1090     {
1091         return _viewUniqueIdsCacheEnabled;
1092     }
1093 
1094     public void setViewUniqueIdsCacheEnabled(boolean viewUniqueIdsCacheEnabled)
1095     {
1096         _viewUniqueIdsCacheEnabled = viewUniqueIdsCacheEnabled;
1097     }
1098 
1099     public boolean isSupportJSPAndFacesEL()
1100     {
1101         return _supportJSPAndFacesEL;
1102     }
1103 
1104     public void setSupportJSPAndFacesEL(
1105             boolean supportJSPANDFacesEL)
1106     {
1107         _supportJSPAndFacesEL = supportJSPANDFacesEL;
1108     }
1109 
1110     public int getComponentUniqueIdsCacheSize()
1111     {
1112         return _componentUniqueIdsCacheSize;
1113     }
1114 
1115     public void setComponentUniqueIdsCacheSize(int componentUniqueIdsCacheSize)
1116     {
1117         this._componentUniqueIdsCacheSize = componentUniqueIdsCacheSize;
1118     }
1119 }