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