Top Description Fields Constructors Methods
jakarta.faces.application

public abstract Class Application

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

Application represents a per-web-application singleton object where applications based on Jakarta Faces (or implementations wishing to provide extended functionality) can register application-wide singletons that provide functionality required by Jakarta 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 Jakarta Expression Language 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 Jakarta Expression Language resolver to add.
resolver
)

Cause an the argument resolver to be added to the resolver chain as specified in section 5.3.2 "ELResolver" of the Jakarta Faces Specification Document.

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 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 "jakarta.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 jakarta.faces.convert.DateTimeConverter, jakarta.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 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 jakarta.faces.application.ResourceDependency annotation.

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 jakarta.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 Jakarta Expression Language context listeners.
getELContextListeners
()

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

public ELResolver

Returns:

the Jakarta Expression Language resolver.
getELResolver
()

Return the singleton ELResolver instance to be used for all Jakarta Expression Language 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 Jakarta 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 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 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 jakarta.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 Jakarta Expression Language 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 jakarta.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 Jakarta 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 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
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 jakarta.faces.event.SystemEventListener whose jakarta.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 jakarta.faces.event.SystemEventListener whose jakarta.faces.event.SystemEventListener#processEvent method must be called when events of type systemEventClass are fired.

See subscribeToEvent(java.lang.Class, java.lang.Class, jakarta.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 jakarta.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 jakarta.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