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: 990473 $ $Date: 2010-08-28 21:00:58 -0500 (Sat, 28 Aug 2010) $
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_REFRESH_TRANSIENT_BUILD_ON_PSS
          This param is only valid when partial state saving is on.
static java.lang.String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT
           
static java.lang.String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE
          This param is only valid when partial state saving is on.
static boolean INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT
           
static java.lang.String INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE
          If set true, render the form submit script inline, as in myfaces core 1.2 and earlier versions
static boolean INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_DEFAULT
           
static java.lang.String INIT_PARAM_RESOURCE_VIRTUAL_PATH
           
static java.lang.String INIT_PARAM_RESOURCE_VIRTUAL_PATH_DEFAULT
           
static java.lang.String INIT_PARAM_VALIDATE_XML
          if set to true, tag library XML files and faces config XML files using schema will be validated during application start up
static boolean INIT_PARAM_VALIDATE_XML_DEFAULT
           
static java.lang.String INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG
          Wrap content inside script with xml comment to prevent old browsers to display it.
static boolean INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_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 getDelegateFacesServlet()
           
 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 isRefreshTransientBuildOnPSS()
           
 boolean isRefreshTransientBuildOnPSSAuto()
           
 boolean isRefreshTransientBuildOnPSSPreserveState()
           
 boolean isRenderClearJavascriptOnButton()
          This param renders the clear javascript on button necessary only for compatibility with hidden fields feature of myfaces.
 boolean isRenderFormSubmitScriptInline()
           
 boolean isRenderHiddenFieldsForLinkParams()
           
 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 isSaveFormSubmitLinkIE()
          Add a code that save the form when submit a form using a link.
 boolean isStrictXhtmlLinks()
          W3C recommends to use the "&" entity instead of a plain "&" character within HTML.
 boolean isTomahawkAvailable()
           
 boolean isValidateXML()
           
 boolean isViewStateJavascript()
           
 boolean isWrapScriptContentWithXmlCommentTag()
           
 void setCheckExtensionsFilter(boolean extensionsFilter)
           
 void setConfigRefreshPeriod(long configRefreshPeriod)
           
 void setDelegateFacesServlet(java.lang.String delegateFacesServlet)
           
 void setRefreshTransientBuildOnPSS(boolean refreshTransientBuildOnPSS)
           
 void setRefreshTransientBuildOnPSSAuto(boolean refreshTransientBuildOnPSSAuto)
           
 void setRefreshTransientBuildOnPSSPreserveState(boolean refreshTransientBuildOnPSSPreserveState)
           
 void setRenderClearJavascriptOnButton(boolean renderClearJavascriptOnButton)
           
 void setRenderFormSubmitScriptInline(boolean renderFormSubmitScriptInline)
           
 void setRenderHiddenFieldsForLinkParams(boolean renderHiddenFieldsForLinkParams)
           
 void setRenderViewStateId(boolean renderViewStateId)
           
 void setSaveFormSubmitLinkIE(boolean saveFormSubmitLinkIE)
           
 void setStrictXhtmlLinks(boolean strictXhtmlLinks)
           
 void setValidateXML(boolean validateXML)
           
 void setWrapScriptContentWithXmlCommentTag(boolean wrapScriptContentWithXmlCommentTag)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

INIT_PARAM_CONFIG_REFRESH_PERIOD

@JSFWebConfigParam(defaultValue="2",
                   since="1.1")
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_REFRESH_TRANSIENT_BUILD_ON_PSS

@JSFWebConfigParam(since="2.0",
                   defaultValue="auto",
                   expectedValues="true,false,auto")
public static final java.lang.String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS
This param is only valid when partial state saving is on. If this is set as true, the tag-handlers are reapplied like in facelets 1.1.x, allowing c:if work correctly to "toggle" components based on a value changed on invoke application phase.

See Also:
Constant Field Values

INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT

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

INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE

@JSFWebConfigParam(since="2.0",
                   defaultValue="false")
public static final java.lang.String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE
This param is only valid when partial state saving is on. If this is set as true, parent components containing c:if, c:forEach, c:choose and ui:insert with src=ELExpression are marked to be restored fully, so state is preserved between request.

See Also:
Constant Field Values

INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT

public static final boolean INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT
See Also:
Constant Field Values

INIT_PARAM_VALIDATE_XML

@JSFWebConfigParam(since="2.0",
                   expectedValues="true,false")
public static final java.lang.String INIT_PARAM_VALIDATE_XML
if set to true, tag library XML files and faces config XML files using schema will be validated during application start up

See Also:
Constant Field Values

INIT_PARAM_VALIDATE_XML_DEFAULT

public static final boolean INIT_PARAM_VALIDATE_XML_DEFAULT
See Also:
Constant Field Values

INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG

@JSFWebConfigParam(since="2.0.1",
                   expectedValues="true,false",
                   defaultValue="true")
public static final java.lang.String INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG
Wrap content inside script with xml comment to prevent old browsers to display it. By default it is true.

See Also:
Constant Field Values

INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT

public static final boolean INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT
See Also:
Constant Field Values

INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE

@JSFWebConfigParam(since="2.0.2",
                   expectedValues="true,false",
                   defaultValue="false")
public static final java.lang.String INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE
If set true, render the form submit script inline, as in myfaces core 1.2 and earlier versions

See Also:
Constant Field Values

INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_DEFAULT

public static final boolean INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_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()

getConfigRefreshPeriod

public long getConfigRefreshPeriod()

setConfigRefreshPeriod

public void setConfigRefreshPeriod(long configRefreshPeriod)

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)

isViewStateJavascript

public boolean isViewStateJavascript()

setRenderClearJavascriptOnButton

public void setRenderClearJavascriptOnButton(boolean renderClearJavascriptOnButton)

isRenderClearJavascriptOnButton

public boolean isRenderClearJavascriptOnButton()
This param renders the clear javascript on button necessary only for compatibility with hidden fields feature of myfaces. This is done because jsf ri does not render javascript on onclick method for button, so myfaces should do this.

Returns:

isRenderHiddenFieldsForLinkParams

public boolean isRenderHiddenFieldsForLinkParams()

setRenderHiddenFieldsForLinkParams

public void setRenderHiddenFieldsForLinkParams(boolean renderHiddenFieldsForLinkParams)

setSaveFormSubmitLinkIE

public void setSaveFormSubmitLinkIE(boolean saveFormSubmitLinkIE)

isSaveFormSubmitLinkIE

public boolean isSaveFormSubmitLinkIE()
Add a code that save the form when submit a form using a link. It's a bug on IE.

Returns:

getDelegateFacesServlet

public java.lang.String getDelegateFacesServlet()

setDelegateFacesServlet

public void setDelegateFacesServlet(java.lang.String delegateFacesServlet)

isRefreshTransientBuildOnPSS

public boolean isRefreshTransientBuildOnPSS()

setRefreshTransientBuildOnPSS

public void setRefreshTransientBuildOnPSS(boolean refreshTransientBuildOnPSS)

isRefreshTransientBuildOnPSSAuto

public boolean isRefreshTransientBuildOnPSSAuto()

setRefreshTransientBuildOnPSSAuto

public void setRefreshTransientBuildOnPSSAuto(boolean refreshTransientBuildOnPSSAuto)

isRefreshTransientBuildOnPSSPreserveState

public boolean isRefreshTransientBuildOnPSSPreserveState()

setRefreshTransientBuildOnPSSPreserveState

public void setRefreshTransientBuildOnPSSPreserveState(boolean refreshTransientBuildOnPSSPreserveState)

isValidateXML

public boolean isValidateXML()

setValidateXML

public void setValidateXML(boolean validateXML)

isWrapScriptContentWithXmlCommentTag

public boolean isWrapScriptContentWithXmlCommentTag()

setWrapScriptContentWithXmlCommentTag

public void setWrapScriptContentWithXmlCommentTag(boolean wrapScriptContentWithXmlCommentTag)

isRenderFormSubmitScriptInline

public boolean isRenderFormSubmitScriptInline()

setRenderFormSubmitScriptInline

public void setRenderFormSubmitScriptInline(boolean renderFormSubmitScriptInline)


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