org.apache.myfaces.shared.config
Class MyfacesConfig

java.lang.Object
  extended by org.apache.myfaces.shared.config.MyfacesConfig

public class MyfacesConfig
extends java.lang.Object

Holds all configuration init parameters (from web.xml) that are independent from the core implementation. The parameters in this class are available to all shared, component and implementation classes. See RuntimeConfig for configuration infos that come from the faces-config files and are needed by the core implementation. MyfacesConfig is meant for components that implement some of the extended features of MyFaces. Anyhow, using the MyFaces JSF implementation is no precondition for using MyfacesConfig in custom components. Upon using another JSF implementation (or omitting the extended init parameters) all config properties will simply have their default values.

Version:
$Revision: 682429 $ $Date: 2008-08-04 10:55:32 -0500 (Mon, 04 Aug 2008) $
Author:
Manfred Geiler (latest modification by $Author: lu4242 $)

Field Summary
static java.lang.String INIT_PARAM_CONFIG_REFRESH_PERIOD
           
static long INIT_PARAM_CONFIG_REFRESH_PERIOD_DEFAULT
           
static java.lang.String INIT_PARAM_RESOURCE_VIRTUAL_PATH
           
static java.lang.String INIT_PARAM_RESOURCE_VIRTUAL_PATH_DEFAULT
           
 
Constructor Summary
MyfacesConfig()
           
 
Method Summary
 java.lang.String getAddResourceClass()
           
static java.lang.String getAddResourceClassFromServletContext(javax.servlet.ServletContext servletContext)
          ExtensionFilter needs access to AddResourceClass init param without having an ExternalContext at hand.
 long getConfigRefreshPeriod()
           
static MyfacesConfig getCurrentInstance(javax.faces.context.ExternalContext extCtx)
           
 java.lang.String getResourceVirtualPath()
           
 boolean isAllowJavascript()
          Do not use this in renderers directly! You should use JavascriptUtils.isJavascriptAllowed(javax.faces.context.ExternalContext) to determine if javascript is allowed or not.
 boolean isAutoScroll()
           
 boolean isCheckExtensionsFilter()
          Should the environment be checked so that the ExtensionsFilter will work properly.
 boolean isDetectJavascript()
           
 boolean isMyfacesImplAvailable()
           
 boolean isPrettyHtml()
           
 boolean isReadonlyAsDisabledForSelect()
           
 boolean isRenderViewStateId()
          JSF API 1.2 defines a "javax.faces.ViewState" client parameter, that must be rendered as both the "name" and the "id" attribute of the hidden input that is rendered for the purpose of state saving (see API).
 boolean isRiImplAvailable()
           
 boolean isStrictXhtmlLinks()
          W3C recommends to use the "&" entity instead of a plain "&" character within HTML.
 boolean isTomahawkAvailable()
           
 void setCheckExtensionsFilter(boolean extensionsFilter)
           
 void setConfigRefreshPeriod(long configRefreshPeriod)
           
 void setRenderViewStateId(boolean renderViewStateId)
           
 void setStrictXhtmlLinks(boolean strictXhtmlLinks)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT_PARAM_CONFIG_REFRESH_PERIOD

public static final java.lang.String INIT_PARAM_CONFIG_REFRESH_PERIOD
See Also:
Constant Field Values

INIT_PARAM_CONFIG_REFRESH_PERIOD_DEFAULT

public static final long INIT_PARAM_CONFIG_REFRESH_PERIOD_DEFAULT
See Also:
Constant Field Values

INIT_PARAM_RESOURCE_VIRTUAL_PATH

public static final java.lang.String INIT_PARAM_RESOURCE_VIRTUAL_PATH
See Also:
Constant Field Values

INIT_PARAM_RESOURCE_VIRTUAL_PATH_DEFAULT

public static final java.lang.String INIT_PARAM_RESOURCE_VIRTUAL_PATH_DEFAULT
See Also:
Constant Field Values
Constructor Detail

MyfacesConfig

public MyfacesConfig()
Method Detail

getCurrentInstance

public static MyfacesConfig getCurrentInstance(javax.faces.context.ExternalContext extCtx)

getResourceVirtualPath

public java.lang.String getResourceVirtualPath()

isPrettyHtml

public boolean isPrettyHtml()

isDetectJavascript

public boolean isDetectJavascript()

isReadonlyAsDisabledForSelect

public boolean isReadonlyAsDisabledForSelect()

isRenderViewStateId

public boolean isRenderViewStateId()
JSF API 1.2 defines a "javax.faces.ViewState" client parameter, that must be rendered as both the "name" and the "id" attribute of the hidden input that is rendered for the purpose of state saving (see API). Actually this causes duplicate id attributes and thus invalid XHTML pages when multiple forms are rendered on one page. With the INIT_PARAM_RENDER_VIEWSTATE_ID context parameter you can tune this behaviour.
Set it to Default value is: true (for backwards compatibility and JSF 1.2 compliancy)

Returns:
true, if the client state hidden input "javax.faces.ViewState" id attribute should be rendered

setRenderViewStateId

public void setRenderViewStateId(boolean renderViewStateId)

isStrictXhtmlLinks

public boolean isStrictXhtmlLinks()

W3C recommends to use the "&amp;" entity instead of a plain "&" character within HTML. This also applies to attribute values and thus to the "href" attribute of <a> elements as well. Even more, when XHTML is used as output the usage of plain "&" characters is forbidden and would lead to invalid XML code. Therefore, since version 1.1.6 MyFaces renders the correct "&amp;" entity for links.

The init parameter INIT_PARAM_STRICT_XHTML_LINKS makes it possible to restore the old behaviour and to make MyFaces "bug compatible" to the Sun RI which renders plain "&" chars in links as well.

Returns:
true if ampersand characters ("&") should be correctly rendered as "&amp;" entities within link urls (=default), false for old (XHTML incompatible) behaviour
See Also:
HTML 4.01 Specification, Jira: MYFACES-1774

setStrictXhtmlLinks

public void setStrictXhtmlLinks(boolean strictXhtmlLinks)

isTomahawkAvailable

public boolean isTomahawkAvailable()

isMyfacesImplAvailable

public boolean isMyfacesImplAvailable()

isRiImplAvailable

public boolean isRiImplAvailable()

isAllowJavascript

public boolean isAllowJavascript()
Do not use this in renderers directly! You should use JavascriptUtils.isJavascriptAllowed(javax.faces.context.ExternalContext) to determine if javascript is allowed or not.


isAutoScroll

public boolean isAutoScroll()

getAddResourceClass

public java.lang.String getAddResourceClass()

getAddResourceClassFromServletContext

public static java.lang.String getAddResourceClassFromServletContext(javax.servlet.ServletContext servletContext)
ExtensionFilter needs access to AddResourceClass init param without having an ExternalContext at hand.


isCheckExtensionsFilter

public boolean isCheckExtensionsFilter()
Should the environment be checked so that the ExtensionsFilter will work properly.


setCheckExtensionsFilter

public void setCheckExtensionsFilter(boolean extensionsFilter)

getConfigRefreshPeriod

public long getConfigRefreshPeriod()

setConfigRefreshPeriod

public void setConfigRefreshPeriod(long configRefreshPeriod)


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.