|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
JavaTM Platform, Enterprise Edition, v 5.0
javax.faces.application
|
Constructor Summary | |
---|---|
Application()
|
Method Summary | |
---|---|
abstract void |
addComponent(String componentType,
String componentClass)
Register a new mapping of component type to the name of the corresponding UIComponent class. |
abstract void |
addConverter(Class targetClass,
String converterClass)
Register a new converter class that is capable of performing conversions for the specified target class. |
abstract void |
addConverter(String converterId,
String converterClass)
Register a new mapping of converter id to the name of the corresponding Converter class. |
void |
addELContextListener(ELContextListener listener)
Provide a way for Faces applications to register an ELContextListener that will be notified on creation
of ELContext instances. |
void |
addELResolver(ELResolver resolver)
Cause an the argument resolver to be added to the
resolver chain as specified in section 5.5.1 of the JavaServer
Faces Specification. |
abstract void |
addValidator(String validatorId,
String validatorClass)
Register a new mapping of validator id to the name of the corresponding Validator class. |
abstract UIComponent |
createComponent(String componentType)
Instantiate and return a new UIComponent instance of the
class specified by a previous call to addComponent() for
the specified component type. |
abstract UIComponent |
createComponent(ValueBinding componentBinding,
FacesContext context,
String componentType)
Deprecated. This has been replaced by createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String) . |
UIComponent |
createComponent(ValueExpression componentExpression,
FacesContext context,
String componentType)
Call the getValue() method on the specified
ValueExpression . |
abstract Converter |
createConverter(Class 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. |
abstract Converter |
createConverter(String converterId)
Instantiate and return a new Converter instance of the
class specified by a previous call to addConverter()
for the specified converter id. |
abstract MethodBinding |
createMethodBinding(String ref,
Class[] params)
Deprecated. This has been replaced by calling getExpressionFactory() then ExpressionFactory.createMethodExpression(javax.el.ELContext, java.lang.String, java.lang.Class>, java.lang.Class>[]) . |
abstract Validator |
createValidator(String validatorId)
Instantiate and return a new Validator instance of the
class specified by a previous call to addValidator()
for the specified validator id. |
abstract ValueBinding |
createValueBinding(String ref)
Deprecated. This has been replaced by calling getExpressionFactory() then ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class>) . |
Object |
evaluateExpressionGet(FacesContext context,
String expression,
Class expectedType)
Get a value by evaluating an expression. |
abstract ActionListener |
getActionListener()
Return the default ActionListener to be registered for
all ActionSource components in this
appication. |
abstract Iterator<String> |
getComponentTypes()
Return an Iterator over the set of currently defined
component types for this Application . |
abstract Iterator<String> |
getConverterIds()
Return an Iterator over the set of currently registered
converter ids for this Application . |
abstract Iterator<Class> |
getConverterTypes()
Return an Iterator over the set of Class
instances for which Converter classes have been explicitly
registered. |
abstract Locale |
getDefaultLocale()
Return the default Locale for this application. |
abstract String |
getDefaultRenderKitId()
Return the renderKitId to be used for rendering
this application. |
ELContextListener[] |
getELContextListeners()
If no calls have been made to addELContextListener(javax.el.ELContextListener) ,
this method must return an empty array. |
ELResolver |
getELResolver()
Return the singleton ELResolver instance to be used
for all EL resolution. |
ExpressionFactory |
getExpressionFactory()
Return the ExpressionFactory instance for this
application. |
abstract String |
getMessageBundle()
Return the fully qualified class name of the ResourceBundle to be used for JavaServer Faces messages
for this application. |
abstract NavigationHandler |
getNavigationHandler()
Return the NavigationHandler instance that will be passed
the outcome returned by any invoked application action for this
web application. |
abstract PropertyResolver |
getPropertyResolver()
Deprecated. This has been replaced by getELResolver() . |
ResourceBundle |
getResourceBundle(FacesContext ctx,
String name)
Find a ResourceBundle as defined in the
application configuration resources under the specified name. |
abstract StateManager |
getStateManager()
Return the StateManager instance that will be utilized
during the Restore View and Render Response
phases of the request processing lifecycle. |
abstract Iterator<Locale> |
getSupportedLocales()
Return an Iterator over the supported
Locale s for this appication. |
abstract Iterator<String> |
getValidatorIds()
Return an Iterator over the set of currently registered
validator ids for this Application . |
abstract VariableResolver |
getVariableResolver()
Deprecated. This has been replaced by getELResolver() . |
abstract ViewHandler |
getViewHandler()
Return the ViewHandler instance that will be utilized
during the Restore View and Render Response
phases of the request processing lifecycle. |
void |
removeELContextListener(ELContextListener listener)
Remove the argument listener from the list of
ELContextListener s. |
abstract void |
setActionListener(ActionListener listener)
Set the default ActionListener to be registered for all
ActionSource components. |
abstract void |
setDefaultLocale(Locale locale)
Set the default Locale for this application. |
abstract void |
setDefaultRenderKitId(String renderKitId)
Set the renderKitId to be used to render this
application. |
abstract void |
setMessageBundle(String bundle)
Set the fully qualified class name of the ResourceBundle
to be used for JavaServer Faces messages for this application. |
abstract void |
setNavigationHandler(NavigationHandler handler)
Set the NavigationHandler instance that will be passed
the outcome returned by any invoked application action for this
web application. |
abstract void |
setPropertyResolver(PropertyResolver 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.
This method now will cause the argument resolver to
be wrapped inside an implementation of ELResolver and
exposed to the EL resolution system as if the user had called
addELResolver(javax.el.ELResolver) . |
abstract void |
setStateManager(StateManager manager)
Set the StateManager instance that will be utilized
during the Restore View and Render Response
phases of the request processing lifecycle. |
abstract void |
setSupportedLocales(Collection<Locale> locales)
Set the Locale instances representing the supported
Locale s for this application. |
abstract void |
setVariableResolver(VariableResolver 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.
This method now will cause the argument resolver to
be wrapped inside an implementation of ELResolver and
exposed to the EL resolution system as if the user had called
addELResolver(javax.el.ELResolver) . |
abstract void |
setViewHandler(ViewHandler handler)
Set the ViewHandler instance that will be utilized
during the Restore View and Render Response
phases of the request processing lifecycle. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Application()
Method Detail |
---|
public abstract ActionListener getActionListener()
Return the default ActionListener
to be registered for
all ActionSource
components in this
appication. If not explicitly set, a default implementation must
be provided that performs the
following functions:
processAction()
method must first call
FacesContext.renderResponse()
in order to bypass
any intervening lifecycle phases, once the method returns.processAction()
method must next determine
the logical outcome of this event, as follows:
null
action
property, retrieve the MethodBinding
from the property, and call
invoke()
on it. Convert the returned value (if
any) to a String, and use it as the logical outcome.null
.processAction()
method must finally retrieve
the NavigationHandler
instance for this
application and call NavigationHandler.handleNavigation(javax.faces.context.FacesContext, java.lang.String, java.lang.String)
passing:
FacesContext
for the current requestMethodBinding
instance for the
action
property of this component, the result of
calling MethodBinding.getExpressionString()
on it, null
otherwiseNote that the specification for the default
ActionListener
contiues to call for the use of a
deprecated property (action
) and
class (MethodBinding
). Unfortunately, this is
necessary because the default ActionListener
must
continue to work with components that do not implement ActionSource2
, and only implement ActionSource
.
public abstract void setActionListener(ActionListener listener)
Set the default ActionListener
to be registered for all
ActionSource
components.
listener
- The new default ActionListener
NullPointerException
- if listener
is null
public abstract Locale getDefaultLocale()
Return the default Locale
for this application. If
not explicitly set, null
is returned.
public abstract void setDefaultLocale(Locale locale)
Set the default Locale
for this application.
locale
- The new default Locale
NullPointerException
- if locale
is null
public abstract String getDefaultRenderKitId()
Return the renderKitId
to be used for rendering
this application. If not explicitly set, null
is
returned.
public abstract void setDefaultRenderKitId(String renderKitId)
Set the renderKitId
to be used to render this
application. Unless the client has provided a custom ViewHandler
that supports the use of multiple RenderKit
instances in the same application, this method must only be called at
application startup, before any Faces requests have been processed.
This is a limitation of the current Specification, and may be lifted in
a future release.
public abstract String getMessageBundle()
Return the fully qualified class name of the
ResourceBundle
to be used for JavaServer Faces messages
for this application. If not explicitly set, null
is returned.
public abstract void setMessageBundle(String bundle)
Set the fully qualified class name of the ResourceBundle
to be used for JavaServer Faces messages for this application. See the
JavaDocs for the java.util.ResourceBundle
class for more
information about the syntax for resource bundle names.
bundle
- Base name of the resource bundle to be used
NullPointerException
- if bundle
is null
public abstract NavigationHandler getNavigationHandler()
Return the NavigationHandler
instance that will be passed
the outcome returned by any invoked application action for this
web application. If not explicitly set, a default implementation
must be provided that performs the functions described in the
NavigationHandler
class description.
public abstract void setNavigationHandler(NavigationHandler handler)
Set the NavigationHandler
instance that will be passed
the outcome returned by any invoked application action for this
web application.
handler
- The new NavigationHandler
instance
NullPointerException
- if handler
is null
public abstract PropertyResolver getPropertyResolver()
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.
Note that this no longer returns the default
PropertyResolver
since that class is now a no-op
that aids in allowing custom PropertyResolver
s to
affect the EL resolution process.
public abstract void setPropertyResolver(PropertyResolver resolver)
<el-resolver>
element at the
right place in the application configuration resources which will
be considered in the normal course of expression evaluation.
This method now will cause the argument resolver
to
be wrapped inside an implementation of ELResolver
and
exposed to the EL resolution system as if the user had called
addELResolver(javax.el.ELResolver)
.
Set the PropertyResolver
instance that will be utilized
to resolve method and value bindings.
This method is now deprecated but the implementation must
cause the argument to be set as the head of the legacy
PropertyResolver
chain, replacing any existing value
that was set from the application configuration resources.
It is illegal to call this method after the application has received any requests from the client. If an attempt is made to register a listener after that time it must have no effect.
resolver
- The new PropertyResolver
instance
NullPointerException
- if resolver
is null
IllegalStateException
- if called after the first
request to the FacesServlet
has been
serviced.public ResourceBundle getResourceBundle(FacesContext ctx, String name)
Find a ResourceBundle
as defined in the
application configuration resources under the specified name. If
a ResourceBundle
was defined for the name, return an
instance that uses the locale of the current UIViewRoot
.
The default implementation throws
UnsupportedOperationException
and is provided
for the sole purpose of not breaking existing applications that extend
this class.
ResourceBundle
for the current UIViewRoot,
otherwise null
FacesException
- if a bundle was defined, but not resolvable
NullPointerException
- if ctx == null || name == nullpublic abstract VariableResolver getVariableResolver()
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. The implementation of the
VariableResolver
must pass null
as the
base argument for any methods invoked on the underlying
ELResolver
.
Note that this method no longer returns the default
VariableResolver
, since that class now is a no-op
that aids in allowing custom VariableResolver
s to
affect the EL resolution process.
public abstract void setVariableResolver(VariableResolver resolver)
<el-resolver>
element at the
right place in the application configuration resources which will
be considered in the normal course of expression evaluation.
This method now will cause the argument resolver
to
be wrapped inside an implementation of ELResolver
and
exposed to the EL resolution system as if the user had called
addELResolver(javax.el.ELResolver)
.
Set the VariableResolver
instance that will be consulted
to resolve method and value bindings.
This method is now deprecated but the implementation must
cause the argument to be set as the head of the legacy
VariableResolver
chain, replacing any existing value
that was set from the application configuration resources.
It is illegal to call this method after the application has received any requests from the client. If an attempt is made to register a listener after that time it must have no effect.
resolver
- The new VariableResolver
instance
NullPointerException
- if resolver
is null
IllegalStateException
- if called after the first
request to the FacesServlet
has been
serviced.public void addELResolver(ELResolver resolver)
Cause an the argument resolver
to be added to the
resolver chain as specified in section 5.5.1 of the JavaServer
Faces Specification.
It is not possible to remove an ELResolver
registered with this method, once it has been registered.
It is illegal to register an ELResolver
after
the application has received any requests from the client. If an
attempt is made to register a listener after that time, an
IllegalStateException
must be thrown. This restriction is
in place to allow the JSP container to optimize for the common
case where no additional ELResolver
s are in the
chain, aside from the standard ones. It is permissible to add
ELResolver
s before or after initialization to a
CompositeELResolver
that is already in the
chain.
The default implementation throws
UnsupportedOperationException
and is provided
for the sole purpose of not breaking existing applications that extend
Application
.
public ELResolver getELResolver()
Return the singleton ELResolver
instance to be used
for all EL resolution. This is actually an instance of CompositeELResolver
that must contain the following
ELResolver
instances in the following order:
ELResolver
instances declared using the
<el-resolver> element in the application configuration
resources.
An implementation
that wraps the head of
the legacy VariableResolver
chain, as per section
VariableResolver ChainWrapper in Chapter 5 in the spec
document.
An implementation
that wraps the head of
the legacy PropertyResolver
chain, as per section
PropertyResolver ChainWrapper in Chapter 5 in the spec
document.
Any ELResolver
instances added by calls to
addELResolver(javax.el.ELResolver)
.
The default implementation throws UnsupportedOperationException
and is provided for the sole purpose of not breaking existing applications
that extend Application
.
public abstract ViewHandler getViewHandler()
Return the ViewHandler
instance that will be utilized
during the Restore View and Render Response
phases of the request processing lifecycle. If not explicitly set,
a default implementation must be provided that performs the functions
described in the ViewHandler
description in the
JavaServer Faces Specification.
public abstract void setViewHandler(ViewHandler handler)
Set the ViewHandler
instance that will be utilized
during the Restore View and Render Response
phases of the request processing lifecycle.
handler
- The new ViewHandler
instance
IllegalStateException
- if this method is called after
at least one request has been processed by the
Lifecycle
instance for this application.
NullPointerException
- if handler
is null
public abstract StateManager getStateManager()
Return the StateManager
instance that will be utilized
during the Restore View and Render Response
phases of the request processing lifecycle. If not explicitly set,
a default implementation must be provided that performs the functions
described in the StateManager
description
in the JavaServer Faces Specification.
public abstract void setStateManager(StateManager manager)
Set the StateManager
instance that will be utilized
during the Restore View and Render Response
phases of the request processing lifecycle.
manager
- The new StateManager
instance
IllegalStateException
- if this method is called after
at least one request has been processed by the
Lifecycle
instance for this application.
NullPointerException
- if manager
is null
public abstract void addComponent(String componentType, String componentClass)
Register a new mapping of component type to the name of the
corresponding UIComponent
class. This allows subsequent calls
to createComponent()
to serve as a factory for
UIComponent
instances.
componentType
- The component type to be registeredcomponentClass
- The fully qualified class name of the
corresponding UIComponent
implementation
NullPointerException
- if componentType
or
componentClass
is null
public abstract UIComponent createComponent(String componentType) throws FacesException
Instantiate and return a new UIComponent
instance of the
class specified by a previous call to addComponent()
for
the specified component type.
componentType
- The component type for which to create and
return a new UIComponent
instance
FacesException
- if a UIComponent
of the
specified type cannot be created
NullPointerException
- if componentType
is null
public abstract UIComponent createComponent(ValueBinding componentBinding, FacesContext context, String componentType) throws FacesException
createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String)
.
Wrap the argument componentBinding
in an
implementation of ValueExpression
and call through to
createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String)
.
componentBinding
- ValueBinding
representing a
component value binding expression (typically specified by the
component
attribute of a custom tag)context
- FacesContext
for the current requestcomponentType
- Component type to create if the ValueBinding
does not return a component instance
FacesException
- if a UIComponent
cannot be created
NullPointerException
- if any parameter is null
public UIComponent createComponent(ValueExpression componentExpression, FacesContext context, String componentType) throws FacesException
Call the getValue()
method on the specified
ValueExpression
. If it returns a UIComponent
instance, return it as the value of this method. If
it does not, instantiate a new UIComponent
instance of
the specified component type, pass the new component to the
setValue()
method of the specified ValueExpression
, and return it.
componentExpression
- ValueExpression
representing a
component value expression (typically specified by the
component
attribute of a custom tag)context
- FacesContext
for the current requestcomponentType
- Component type to create if the ValueExpression
does not return a component instance
FacesException
- if a UIComponent
cannot be created
NullPointerException
- if any parameter is null
A default implementation is provided that throws
UnsupportedOperationException
so that users
that decorate Application
can continue to function
public abstract Iterator<String> getComponentTypes()
Return an Iterator
over the set of currently defined
component types for this Application
.
public abstract void addConverter(String converterId, String converterClass)
Register a new mapping of converter id to the name of the
corresponding Converter
class. This allows subsequent calls
to createConverter()
to serve as a factory for
Converter
instances.
converterId
- The converter id to be registeredconverterClass
- The fully qualified class name of the
corresponding Converter
implementation
NullPointerException
- if converterId
or converterClass
is null
public abstract void addConverter(Class targetClass, String converterClass)
Register a new converter class that is capable of performing conversions for the specified target class.
targetClass
- The class for which this converter is registeredconverterClass
- The fully qualified class name of the
corresponding Converter
implementation
NullPointerException
- if targetClass
or converterClass
is null
public abstract Converter createConverter(String converterId)
Instantiate and return a new Converter
instance of the
class specified by a previous call to addConverter()
for the specified converter id. If there is no such registration
for this converter id, return null
.
converterId
- The converter id for which to create and
return a new Converter
instance
FacesException
- if the Converter
cannot be
created
NullPointerException
- if converterId
is null
public abstract Converter createConverter(Class 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. If no such Converter
class
can be identified, return null
.
To locate an appropriate Converter
class, the following
algorithm is performed, stopping as soon as an appropriate Converter
class is found:
Converter
registered for the target class itself.
Converter
registered for interfaces that are
implemented by the target class (directly or indirectly).Converter
registered for the superclass (if any)
of the target class, recursively working up the inheritance
hierarchy.If the Converter
has a single argument constructor that
accepts a Class
, instantiate the Converter
using that constructor, passing the argument targetClass
as
the sole argument. Otherwise, simply use the zero-argument constructor.
targetClass
- Target class for which to return a Converter
FacesException
- if the Converter
cannot be
created
NullPointerException
- if targetClass
is null
public abstract Iterator<String> getConverterIds()
Return an Iterator
over the set of currently registered
converter ids for this Application
.
public abstract Iterator<Class> getConverterTypes()
Return an Iterator
over the set of Class
instances for which Converter
classes have been explicitly
registered.
public ExpressionFactory getExpressionFactory()
Return the ExpressionFactory
instance for this
application. This instance is used by the convenience method
evaluateExpressionGet(javax.faces.context.FacesContext, java.lang.String, java.lang.Class)
.
The implementation must return the
ExpressionFactory
from the JSP container by calling
JspFactory.getDefaultFactory().getJspApplicationContext(servletContext).getExpressionFactory()
.
An implementation is provided that throws
UnsupportedOperationException
so that users that decorate
the Application
continue to work.
public Object evaluateExpressionGet(FacesContext context, String expression, Class expectedType) throws ELException
Get a value by evaluating an expression.
Call getExpressionFactory()
then call ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class>)
passing the argument
expression
and expectedType
. Call
FacesContext.getELContext()
and pass it to ValueExpression.getValue(javax.el.ELContext)
, returning the result.
An implementation is provided that throws
UnsupportedOperationException
so that users that decorate
the Application
continue to work.
ELException
public abstract MethodBinding createMethodBinding(String ref, Class[] params) throws ReferenceSyntaxException
getExpressionFactory()
then ExpressionFactory.createMethodExpression(javax.el.ELContext, java.lang.String, java.lang.Class>, java.lang.Class>[])
.
Call getExpressionFactory()
then call ExpressionFactory.createMethodExpression(javax.el.ELContext, java.lang.String, java.lang.Class>, java.lang.Class>[])
, passing the given
arguments, and wrap the result in a MethodBinding
implementation, returning it.
ref
- Method binding expression for which to return a
MethodBinding
instanceparams
- 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
NullPointerException
- if ref
is null
ReferenceSyntaxException
- if the specified ref
has invalid syntaxpublic abstract Iterator<Locale> getSupportedLocales()
Return an Iterator
over the supported
Locale
s for this appication.
public abstract void setSupportedLocales(Collection<Locale> locales)
Set the Locale
instances representing the supported
Locale
s for this application.
locales
- The set of supported Locale
s
for this application
NullPointerException
- if the argument
newLocales
is null
.public void addELContextListener(ELContextListener listener)
Provide a way for Faces applications to register an
ELContextListener
that will be notified on creation
of ELContext
instances. This listener will be
called once per request.
An implementation is provided that throws
UnsupportedOperationException
so that users that decorate
the Application
continue to work.
public void removeELContextListener(ELContextListener listener)
Remove the argument listener
from the list of
ELContextListener
s. If listener
is null, no
exception is thrown and no action is performed. If
listener
is not in the list, no exception is thrown
and no action is performed.
An implementation is provided that throws
UnsupportedOperationException
so that users that decorate
the Application
continue to work.
public ELContextListener[] getELContextListeners()
If no calls have been made to addELContextListener(javax.el.ELContextListener)
,
this method must return an empty array.
Otherwise, return an array representing the list of listeners
added by calls to addELContextListener(javax.el.ELContextListener)
.
An implementation is provided that throws
UnsupportedOperationException
so that users that decorate
the Application
continue to work.
public abstract void addValidator(String validatorId, String validatorClass)
Register a new mapping of validator id to the name of the
corresponding Validator
class. This allows subsequent calls
to createValidator()
to serve as a factory for
Validator
instances.
validatorId
- The validator id to be registeredvalidatorClass
- The fully qualified class name of the
corresponding Validator
implementation
NullPointerException
- if validatorId
or validatorClass
is null
public abstract Validator createValidator(String validatorId) throws FacesException
Instantiate and return a new Validator
instance of the
class specified by a previous call to addValidator()
for the specified validator id.
validatorId
- The validator id for which to create and
return a new Validator
instance
FacesException
- if a Validator
of the
specified id cannot be created
NullPointerException
- if validatorId
is null
public abstract Iterator<String> getValidatorIds()
Return an Iterator
over the set of currently registered
validator ids for this Application
.
public abstract ValueBinding createValueBinding(String ref) throws ReferenceSyntaxException
getExpressionFactory()
then ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class>)
.
Call getExpressionFactory()
then call ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class>)
, passing the argument
ref
, Object.class
for the expectedType,
and null
, for the fnMapper.
ref
- Value binding expression for which to return a
ValueBinding
instance
NullPointerException
- if ref
is null
ReferenceSyntaxException
- if the specified ref
has invalid syntax