Top Description Fields Constructors Methods
javax.faces.application

public abstract Class Application

extends Object
Class Inheritance
Known Direct Subclasses
javax.faces.application.ApplicationWrapper, com.sun.faces.application.ApplicationImpl
Imports
java.util.Collection, .Collections, .Iterator, .Locale, .ResourceBundle, .Map, javax.faces.FacesException, javax.faces.component.UIComponent, javax.faces.component.behavior.Behavior, javax.faces.context.FacesContext, javax.faces.convert.Converter, javax.faces.el.MethodBinding, .PropertyResolver, .ReferenceSyntaxException, .ValueBinding, .VariableResolver, javax.faces.event.ActionListener, .SystemEvent, .SystemEventListener, javax.el.ELContextListener, .ExpressionFactory, .ValueExpression, .ELException, .ELResolver, javax.faces.component.search.SearchExpressionHandler, .SearchKeywordResolver, javax.faces.flow.FlowHandler, javax.faces.validator.Validator, javax.faces.view.ViewDeclarationLanguage

Application represents a per-web-application singleton object where applications based on JavaServer Faces (or implementations wishing to provide extended functionality) can register application-wide singletons that provide functionality required by JavaServer Faces. Default implementations of each object are provided for cases where the application does not choose to customize the behavior.

The instance of Application is created by calling the getApplication() method of ApplicationFactory. Because this instance is shared, it must be implemented in a thread-safe manner.

The application also acts as a factory for several types of Objects specified in the Faces Configuration file. Please see Application#createComponent, Application#createConverter, and Application#createValidator.

Field Summary

Modifier and TypeField and Description
private Application

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addBehavior(String
The behavior id to be registered
behaviorId
,
String
The fully qualified class name of the corresponding Behavior implementation
behaviorClass
)

Register a new mapping of behavior id to the name of the corresponding Behavior class.

public abstract void
addComponent(String
The component type to be registered
componentType
,
String
The fully qualified class name of the corresponding UIComponent implementation
componentClass
)

Register a new mapping of component type to the name of the corresponding UIComponent class.

public abstract void
addConverter(String
The converter id to be registered
converterId
,
String
The fully qualified class name of the corresponding Converter implementation
converterClass
)

Register a new mapping of converter id to the name of the corresponding Converter class.

public abstract void
addConverter(Class<?>
The class for which this converter is registered
targetClass
,
String
The fully qualified class name of the corresponding Converter implementation
converterClass
)

Register a new converter class that is capable of performing conversions for the specified target class.

public void
addDefaultValidatorId(String
the validator id.
validatorId
)

Register a validator by its id that is applied to all UIInput components in a view.

public void
addELContextListener(ELContextListener
the EL context listener to add.
listener
)

Provide a way for Faces applications to register an ELContextListener that will be notified on creation of ELContext instances.

public void
addELResolver(ELResolver
the EL resolver to add.
resolver
)

Cause an the argument resolver to be added to the resolver chain as specified in section JSF.5.5.1 of the JavaServer Faces Specification.

public void
addSearchKeywordResolver(SearchKeywordResolver
the SearchKeywordResolver to add.
resolver
)

Cause the argument resolver to be added to the head of the resolver chain.

public abstract void
addValidator(String
The validator id to be registered
validatorId
,
String
The fully qualified class name of the corresponding Validator implementation
validatorClass
)

Register a new mapping of validator id to the name of the corresponding Validator class.

public Behavior

Returns:

the behavior.
createBehavior
(String
The behavior id for which to create and return a new Behavior instance
behaviorId
)

Instantiate and return a new Behavior instance of the class specified by a previous call to addBehavior() for the specified behavior id.

public abstract UIComponent

Returns:

the UI component.
createComponent
(String
The component type for which to create and return a new UIComponent instance
componentType
)

Instantiate and return a new UIComponent instance of the class specified by a previous call to addComponent() for the specified component type.

public abstract UIComponent

Returns:

the UI component.
createComponent
(ValueBinding
ValueBinding representing a component value binding expression (typically specified by the component attribute of a custom tag)
componentBinding
,
FacesContext
FacesContext for the current request
context
,
String
Component type to create if the ValueBinding does not return a component instance
componentType
)

Wrap the argument componentBinding in an implementation of ValueExpression and call through to createComponent(javax.el.ValueExpression, javax.faces.context.FacesContext, java.lang.String).

public UIComponent

Returns:

the UI component.
createComponent
(ValueExpression
ValueExpression representing a component value expression (typically specified by the component attribute of a custom tag)
componentExpression
,
FacesContext
FacesContext for the current request
context
,
String
Component type to create if the ValueExpression does not return a component instance
componentType
)

Call the getValue() method on the specified ValueExpression.

public UIComponent

Returns:

the UI component.
createComponent
(ValueExpression
ValueExpression representing a component value expression (typically specified by the component attribute of a custom tag)
componentExpression
,
FacesContext
FacesContext for the current request
context
,
String
Component type to create if the ValueExpression does not return a component instance
componentType
,
String
The renderer-type of the Renderer that will render this component. A null value must be accepted for this parameter.
rendererType
)

Like createComponent(ValueExpression, FacesContext, String) except the Renderer for the component to be returned must be inspected for the annotations mentioned in createComponent(ValueExpression, FacesContext, String) as specified in the documentation for that method.

public UIComponent

Returns:

the UI component.
createComponent
(FacesContext
FacesContext for the current request
context
,
String
Component type to create
componentType
,
String
The renderer-type of the Renderer that will render this component. A null value must be accepted for this parameter.
rendererType
)

Like createComponent(String) except the Renderer for the component to be returned must be inspected for the annotations mentioned in createComponent(ValueExpression, FacesContext, String) as specified in the documentation for that method.

public UIComponent

Returns:

the UI component.
createComponent
(FacesContext
FacesContext for the current request
context
,
Resource
A Resource that points to a source file that provides an implementation of a component.
componentResource
)

Instantiate and return a new UIComponent instance from the argument Resource.

public abstract Converter<T>

Returns:

the converter.
createConverter
(String
The converter id for which to create and return a new Converter instance
converterId
)

Instantiate and return a new Converter instance of the class specified by a previous call to addConverter() for the specified converter id.

If the toLowerCase() of the String represenation of the value of the "javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE" application configuration parameter is "true" (without the quotes) and the Converter instance to be returned is an instance of javax.faces.convert.DateTimeConverter, javax.faces.convert.DateTimeConverter#setTimeZone must be called, passing the return from TimeZone.getDefault().

public abstract Converter<T>

Returns:

the converter.
createConverter
(Class<?>
Target class for which to return a Converter
targetClass
)

Instantiate and return a new Converter instance of the class that has registered itself as capable of performing conversions for objects of the specified type.

public abstract MethodBinding

Returns:

the method binding.
createMethodBinding
(String
Method binding expression for which to return a MethodBinding instance
ref
,
Class<?>[]
Parameter signatures that must be compatible with those of the method to be invoked, or a zero-length array or null for a method that takes no parameters
params
)

Deprecated This has been replaced by calling getExpressionFactory then ExpressionFactory#createMethodExpression.

Call getExpressionFactory then call ExpressionFactory#createMethodExpression, passing the given arguments, and wrap the result in a MethodBinding implementation, returning it.

public abstract Validator<T>

Returns:

the validator.
createValidator
(String
The validator id for which to create and return a new Validator instance
validatorId
)

Instantiate and return a new Validator instance of the class specified by a previous call to addValidator() for the specified validator id.

The argument validator must be inspected for the presence of the javax.faces.application.ResourceDependency annotation.

public abstract ValueBinding

Returns:

the value binding.
createValueBinding
(String
Value binding expression for which to return a ValueBinding instance
ref
)

Deprecated This has been replaced by calling getExpressionFactory then ExpressionFactory#createValueExpression.

Call getExpressionFactory then call ExpressionFactory#createValueExpression, passing the argument ref, Object.class for the expectedType, and null, for the fnMapper.

public <
the return type.
T
>
T

Returns:

the result of the evaluation.
evaluateExpressionGet
(FacesContext
the Faces context.
context
,
String
the expression.
expression
,
Class<? extends T>
the expected type.
expectedType
)

Get a value by evaluating an expression.

public abstract ActionListener

Returns:

the action listener.
getActionListener
()

Return the default ActionListener to be registered for all javax.faces.component.ActionSource components in this application.

public Iterator<String>

Returns:

an iterator with behavior ids.
getBehaviorIds
()

Return an Iterator over the set of currently registered behavior ids for this Application.

public abstract Iterator<String>

Returns:

an iterator with component types.
getComponentTypes
()

Return an Iterator over the set of currently defined component types for this Application.

public abstract Iterator<String>

Returns:

an iterator with converter ids.
getConverterIds
()

Return an Iterator over the set of currently registered converter ids for this Application.

public abstract Iterator<Class<?>>

Returns:

an iterator with converter types.
getConverterTypes
()

Return an Iterator over the set of Class instances for which Converter classes have been explicitly registered.

public abstract Locale

Returns:

the default Locale, or null.
getDefaultLocale
()

Return the default Locale for this application.

public abstract String

Returns:

the default render kit id, or null.
getDefaultRenderKitId
()

Return the renderKitId to be used for rendering this application.

public Map<String, String>

Returns:

a map of default validator information.
getDefaultValidatorInfo
()

Return an immutable Map over the set of currently registered default validator IDs and their class name for this Application.

public ELContextListener[]

Returns:

an array of EL context listeners.
getELContextListeners
()

If no calls have been made to addELContextListener, this method must return an empty array.

public ELResolver

Returns:

the EL resolver.
getELResolver
()

Return the singleton ELResolver instance to be used for all EL resolution.

public ExpressionFactory

Returns:

the expression factory.
getExpressionFactory
()

Return the ExpressionFactory instance for this application.

public FlowHandler

Returns:

the flow handler.
getFlowHandler
()

Return the thread-safe singleton FlowHandler for this application.

public abstract String

Returns:

the message bundle class name, or null.
getMessageBundle
()

Return the fully qualified class name of the ResourceBundle to be used for JavaServer Faces messages for this application.

public abstract NavigationHandler

Returns:

the navigation handler.
getNavigationHandler
()

Return the NavigationHandler instance that will be passed the outcome returned by any invoked application action for this web application.

public ProjectStage

Returns:

the project stage.
getProjectStage
()

Return the project stage for the currently running application instance.

public abstract PropertyResolver

Returns:

the property resolver.
getPropertyResolver
()

Deprecated This has been replaced by getELResolver.

Return a PropertyResolver instance that wraps the ELResolver instance that Faces provides to the unified EL for the resolution of expressions that appear programmatically in an application.

public ResourceBundle

Returns:

the resource bundle.
getResourceBundle
(FacesContext
the Faces context.
ctx
,
String
the name of the resource bundle.
name
)

Find a ResourceBundle as defined in the application configuration resources under the specified name.

public ResourceHandler

Returns:

the resource handler.
getResourceHandler
()

Return the singleton, stateless, thread-safe ResourceHandler for this application.

public SearchExpressionHandler
getSearchExpressionHandler()

Return the thread-safe singleton SearchExpressionHandler for this application.

public SearchKeywordResolver

Returns:

the SearchKeywordResolver.
getSearchKeywordResolver
()

Return the singleton SearchKeywordResolver instance to be used for all search keyword resolution.

public abstract StateManager

Returns:

the state manager.
getStateManager
()

Return the StateManager instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle.

public abstract Iterator<Locale>

Returns:

an iterator of the supported locales.
getSupportedLocales
()

Return an Iterator over the supported Locales for this appication.

public abstract Iterator<String>

Returns:

an iterator of validator ids.
getValidatorIds
()

Return an Iterator over the set of currently registered validator ids for this Application.

public abstract VariableResolver

Returns:

the variable resolver.
getVariableResolver
()

Deprecated This has been replaced by getELResolver.

Return the VariableResolver that wraps the ELResolver instance that Faces provides to the unified EL for the resolution of expressions that appear programmatically in an application.

public abstract ViewHandler

Returns:

the view handler.
getViewHandler
()

Return the ViewHandler instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle.

public void
publishEvent(FacesContext
the FacesContext for the current request
context
,
Class<? extends SystemEvent>
The Class of event that is being published.
systemEventClass
,
Object
The source for the event of type systemEventClass.
source
)

If javax.faces.context.FacesContext#isProcessingEvents() is true and there are one or more listeners for events of the type represented by systemEventClass, call those listeners, passing source as the source of the event.

public void
publishEvent(FacesContext
the FacesContext for the current request
context
,
Class<? extends SystemEvent>
The Class of event that is being published.
systemEventClass
,
Class<?>
The Class of the source event that must be used to lookup the listener to which this event must be published. If this argument is null the return from source.getClass() must be used as the sourceBaseType.
sourceBaseType
,
Object
The source for the event of type systemEventClass.
source
)

This method functions exactly like publishEvent(FacesContext, Class, Object), except the run-time must use the argument sourceBaseType to find the matching listener instead of using the Class of the source argument.

public void
removeELContextListener(ELContextListener
the EL context listener to remove.
listener
)

Remove the argument listener from the list of ELContextListeners.

public abstract void
setActionListener(ActionListener
The new default ActionListener
listener
)

Set the default ActionListener to be registered for all javax.faces.component.ActionSource components.

public abstract void
setDefaultLocale(Locale
The new default Locale
locale
)

Set the default Locale for this application.

public abstract void
setDefaultRenderKitId(String
the render kit id to set.
renderKitId
)

Set the renderKitId to be used to render this application.

public void
setFlowHandler(FlowHandler
the flow handler to set.
newHandler
)

Set the FlowHandler instance used by the NavigationHandler to satisfy the requirements of the faces flows feature.

public abstract void
setMessageBundle(String
Base name of the resource bundle to be used
bundle
)

Set the fully qualified class name of the ResourceBundle to be used for JavaServer Faces messages for this application.

public abstract void
setNavigationHandler(NavigationHandler
The new NavigationHandler instance
handler
)

Set the NavigationHandler instance that will be passed the outcome returned by any invoked application action for this web application.

public abstract void
setPropertyResolver(PropertyResolver
The new PropertyResolver instance
resolver
)

Deprecated The recommended way to affect the execution of the EL is to provide an <el-resolver> element at the right place in the application configuration resources which will be considered in the normal course of expression evaluation.

Set the PropertyResolver instance that will be utilized to resolve method and value bindings.

public void
setResourceHandler(ResourceHandler
The new ResourceHandler instance
resourceHandler
)

Set the ResourceHandler instance that will be utilized for rendering the markup for resources, and for satisfying client requests to serve up resources.

public void
setSearchExpressionHandler(SearchExpressionHandler searchExpressionHandler)

Set the SearchExpressionHandler instance used by the application.

public abstract void
setStateManager(StateManager
The new StateManager instance
manager
)

Set the StateManager instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle.

public abstract void
setSupportedLocales(Collection<Locale>
The set of supported Locales for this application
locales
)

Set the Locale instances representing the supported Locales for this application.

public abstract void
setVariableResolver(VariableResolver
The new VariableResolver instance
resolver
)

Deprecated The recommended way to affect the execution of the EL is to provide an <el-resolver> element at the right place in the application configuration resources which will be considered in the normal course of expression evaluation.

Set the VariableResolver instance that will be consulted to resolve method and value bindings.

public abstract void
setViewHandler(ViewHandler
The new ViewHandler instance
handler
)

Set the ViewHandler instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle.

public void
subscribeToEvent(Class<? extends SystemEvent>
the Class of event for which listener must be fired.
systemEventClass
,
Class<?>
the Class of the instance which causes events of type systemEventClass to be fired. May be null.
sourceClass
,
SystemEventListener
the implementation of javax.faces.event.SystemEventListener whose javax.faces.event.SystemEventListener#processEvent method must be called when events of type systemEventClass are fired.
listener
)

Install the listener instance referenced by argument listener into the application as a listener for events of type systemEventClass that originate from objects of type sourceClass.

public void
subscribeToEvent(Class<? extends SystemEvent>
the Class of event for which listener must be fired.
systemEventClass
,
SystemEventListener
the implementation of javax.faces.event.SystemEventListener whose javax.faces.event.SystemEventListener#processEvent method must be called when events of type systemEventClass are fired.

See subscribeToEvent(java.lang.Class, java.lang.Class, javax.faces.event.SystemEventListener) for an additional requirement regarding when it is valid to call this method.

listener
)

Install the listener instance referenced by argument listener into application as a listener for events of type systemEventClass.

public void
unsubscribeFromEvent(Class<? extends SystemEvent>
the Class of event for which listener must be fired.
systemEventClass
,
Class<?>
the Class of the instance which causes events of type systemEventClass to be fired. May be null.
sourceClass
,
SystemEventListener
the implementation of javax.faces.event.SystemEventListener to remove from the internal data structure.
listener
)

Remove the listener instance referenced by argument listener from the application as a listener for events of type systemEventClass that originate from objects of type sourceClass.

public void
unsubscribeFromEvent(Class<? extends SystemEvent>
the Class of event for which listener must be fired.
systemEventClass
,
SystemEventListener
the implementation of javax.faces.event.SystemEventListener to remove from the internal data structure.
listener
)

Remove the listener instance referenced by argument listener from the application as a listener for events of type systemEventClass.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait