Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*
    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    *
    * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
    *
    * The contents of this file are subject to the terms of either the GNU
    * General Public License Version 2 only ("GPL") or the Common Development
    * and Distribution License("CDDL") (collectively, the "License").  You
    * may not use this file except in compliance with the License.  You can
   * obtain a copy of the License at
   * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
   * or packager/legal/LICENSE.txt.  See the License for the specific
   * language governing permissions and limitations under the License.
   *
   * When distributing the software, include this License Header Notice in each
   * file and include the License file at packager/legal/LICENSE.txt.
   *
   * GPL Classpath Exception:
   * Oracle designates this particular file as subject to the "Classpath"
   * exception as provided by Oracle in the GPL Version 2 section of the License
   * file that accompanied this code.
   *
   * Modifications:
   * If applicable, add the following below the License Header, with the fields
   * enclosed by brackets [] replaced by your own identifying information:
   * "Portions Copyright [year] [name of copyright owner]"
   *
   * Contributor(s):
   * If you wish your version of this file to be governed by only the CDDL or
   * only the GPL Version 2, indicate your decision by adding "[Contributor]
   * elects to include this software in this distribution under the [CDDL or GPL
   * Version 2] license."  If you don't indicate a single choice of license, a
   * recipient has the option to distribute your version of this file under
   * either the CDDL, the GPL Version 2 or to extend the choice of license to
   * its licensees as provided above.  However, if you add GPL Version 2 code
   * and therefore, elected the GPL Version 2 license, then the option applies
   * only if the new code is made subject to such option by the copyright
   * holder.
   */
  
  package javax.faces.application;
  
  
  import java.util.Locale;
  import java.util.Map;
  
  

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 createComponent(java.lang.String), createConverter(java.lang.String), and createValidator(java.lang.String).

  
  
  public abstract class Application {
  
      @SuppressWarnings({"UnusedDeclaration"})
      private Application defaultApplication;
  
     // ------------------------------------------------------------- Properties
 

    

Return the default javax.faces.event.ActionListener to be registered for all javax.faces.component.ActionSource components in this appication. If not explicitly set, a default implementation must be provided that performs the following functions:

Note 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 javax.faces.component.ActionSource2, and only implement javax.faces.component.ActionSource.

 
     public abstract ActionListener getActionListener();


    

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

Parameters:
listener The new default javax.faces.event.ActionListener
Throws:
java.lang.NullPointerException if listener is null
 
     public abstract void setActionListener(ActionListener listener);

    

Return the default Locale for this application. If not explicitly set, null is returned.

  
     public abstract Locale getDefaultLocale();


    

Set the default Locale for this application.

Parameters:
locale The new default Locale
Throws:
java.lang.NullPointerException if locale is null
 
     public abstract void setDefaultLocale(Locale locale);


    

Return the renderKitId to be used for rendering this application. If not explicitly set, null is returned.

 
     public abstract String getDefaultRenderKitId();


    

Set the renderKitId to be used to render this application. Unless the client has provided a custom ViewHandler that supports the use of multiple javax.faces.render.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 void setDefaultRenderKitId(String renderKitId);



    

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 String getMessageBundle();


    

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.

Parameters:
bundle Base name of the resource bundle to be used
Throws:
java.lang.NullPointerException if bundle is null
 
     public abstract void setMessageBundle(String bundle);


    

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 NavigationHandler getNavigationHandler();


    

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

Parameters:
handler The new NavigationHandler instance
Throws:
java.lang.NullPointerException if handler is null
 
     public abstract void setNavigationHandler(NavigationHandler handler);

    

Return the singleton, stateless, thread-safe ResourceHandler for this application. The JSF implementation must support the following techniques for declaring an alternate implementation of ResourceHandler.

  • The ResourceHandler implementation is declared in the application configuration resources by giving the fully qualified class name as the value of the <resource-handler> element within the <application> element.

In all of the above cases, the runtime must employ the decorator pattern as for every other pluggable artifact in JSF.

A default implementation is provided that throws UnsupportedOperationException so that users that decorate Application can continue to function

.

Since:
2.0
 
     public ResourceHandler getResourceHandler() {
 
         if ( != null) {
             return .getResourceHandler();
         }
 
         throw new UnsupportedOperationException();
         
     }

    

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

Parameters:
resourceHandler The new ResourceHandler instance
Throws:
java.lang.IllegalStateException if this method is called after at least one request has been processed by the Lifecycle instance for this application.
java.lang.NullPointerException if resourceHandler is null
Since:
2.0
 
     public void setResourceHandler(ResourceHandler resourceHandler) {
 
         if ( != null) {
             .setResourceHandler(resourceHandler);
         } else {
             throw new UnsupportedOperationException();
         }
         
     }
    

    

Return a javax.faces.el.PropertyResolver instance that wraps the javax.el.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 PropertyResolvers to affect the EL resolution process.

Deprecated:
This has been replaced by getELResolver().
 
     public abstract PropertyResolver getPropertyResolver();


    

Set the javax.faces.el.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.

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 javax.el.ELResolver and exposed to the EL resolution system as if the user had called addELResolver(javax.el.ELResolver).
Parameters:
resolver The new javax.faces.el.PropertyResolver instance
Throws:
java.lang.NullPointerException if resolver is null
java.lang.IllegalStateException if called after the first request to the javax.faces.webapp.FacesServlet has been serviced.
 
     public abstract void setPropertyResolver(PropertyResolver resolver);
    
    

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 javax.faces.component.UIViewRoot.

The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

Returns:
ResourceBundle for the current UIViewRoot, otherwise null
Throws:
javax.faces.FacesException if a bundle was defined, but not resolvable
java.lang.NullPointerException if ctx == null || name == null
Since:
1.2
 
     
     public ResourceBundle getResourceBundle(FacesContext ctxString name) {
 
         if ( != null) {
             return .getResourceBundle(ctxname);
         }
         
         throw new UnsupportedOperationException();
 
     }


    

Return the project stage for the currently running application instance. The default value is ProjectStage.Production

The implementation of this method must perform the following algorithm or an equivalent with the same end result to determine the value to return.

    If the value has already been determined by a previous call to this method, simply return that value.

    Look for a JNDI environment entry under the key given by the value of ProjectStage.PROJECT_STAGE_JNDI_NAME (return type of java.lang.String). If found, continue with the algorithm below, otherwise, look for an entry in the initParamMap of the ExternalContext from the current FacesContext with the key given by the value of ProjectStage.PROJECT_STAGE_PARAM_NAME

    If a value is found, see if an enum constant can be obtained by calling ProjectStage.valueOf(), passing the value from the initParamMap. If this succeeds without exception, save the value and return it.

    If not found, or any of the previous attempts to discover the enum constant value have failed, log a descriptive error message, assign the value as ProjectStage.Production and return it.

A default implementation is provided that throws UnsupportedOperationException so that users that decorate Application can continue to function

.

Since:
2.0
 
     public ProjectStage getProjectStage() {
         
         if ( != null) {
             return .getProjectStage();
         }
         
         return .;
     }


    

Return the javax.faces.el.VariableResolver that wraps the javax.el.ELResolver instance that Faces provides to the unified EL for the resolution of expressions that appear programmatically in an application. The implementation of the VariableResolvermust 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 VariableResolvers to affect the EL resolution process.

Deprecated:
This has been replaced by getELResolver().
 
     public abstract VariableResolver getVariableResolver();


    

Set the javax.faces.el.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.

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 javax.el.ELResolver and exposed to the EL resolution system as if the user had called addELResolver(javax.el.ELResolver).
Parameters:
resolver The new javax.faces.el.VariableResolver instance
Throws:
java.lang.NullPointerException if resolver is null
java.lang.IllegalStateException if called after the first request to the javax.faces.webapp.FacesServlet has been serviced.
 
     public abstract void setVariableResolver(VariableResolver 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.

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 ELResolvers are in the chain, aside from the standard ones. It is permissible to add ELResolvers 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.

Throws:
java.lang.IllegalStateException if called after the first request to the javax.faces.webapp.FacesServlet has been serviced.
Since:
1.2
 
 
     public void addELResolver(ELResolver resolver) {
 
         if ( != null) {
             .addELResolver(resolver);
         } else {
             throw new UnsupportedOperationException();
         }
 
     }

    

Return the singleton javax.el.ELResolver instance to be used for all EL resolution. This is actually an instance of javax.el.CompositeELResolver that must contain the following ELResolver instances in the following order:

  1. ELResolver instances declared using the <el-resolver> element in the application configuration resources.

  2. An implementation that wraps the head of the legacy VariableResolver chain, as per section VariableResolver ChainWrapper in Chapter JSF.5 in the spec document.

  3. An implementation that wraps the head of the legacy PropertyResolver chain, as per section PropertyResolver ChainWrapper in Chapter JSF.5 in the spec document.

  4. 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.

Since:
1.2
 
 
     public ELResolver getELResolver() {
 
         if ( != null) {
             return .getELResolver();
         }
         throw new UnsupportedOperationException();
 
     }


    

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 ViewHandler getViewHandler();


    

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

Parameters:
handler The new ViewHandler instance
Throws:
java.lang.IllegalStateException if this method is called after at least one request has been processed by the Lifecycle instance for this application.
java.lang.NullPointerException if handler is null
 
     public abstract void setViewHandler(ViewHandler handler);



    

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 StateManager getStateManager();


    

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

Parameters:
manager The new StateManager instance
Throws:
java.lang.IllegalStateException if this method is called after at least one request has been processed by the Lifecycle instance for this application.
java.lang.NullPointerException if manager is null
 
     public abstract void setStateManager(StateManager manager);
 
 
     // ------------------------------------------------------- Object Factories
 
    

Register a new mapping of behavior id to the name of the corresponding javax.faces.component.behavior.Behavior class. This allows subsequent calls to createBehavior() to serve as a factory for javax.faces.component.behavior.Behavior instances.

Parameters:
behaviorId The behavior id to be registered
behaviorClass The fully qualified class name of the corresponding javax.faces.component.behavior.Behavior implementation
Throws:
java.lang.NullPointerException if behaviorId or behaviorClass is null
Since:
2.0
 
     public void addBehavior(String behaviorId
         String behaviorClass) {
 
         if ( != null) {
             .addBehavior(behaviorIdbehaviorClass);
         }
 
     }
    
    

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

Parameters:
behaviorId The behavior id for which to create and return a new javax.faces.component.behavior.Behavior instance
Throws:
javax.faces.FacesException if the javax.faces.component.behavior.Behavior cannot be created
java.lang.NullPointerException if behaviorId is null
 
     public Behavior createBehavior(String behaviorId)
     	throws FacesException {
 
         if ( != null) {
             return .createBehavior(behaviorId);
         }
         return null;
 
     }

    

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

 
     public Iterator<StringgetBehaviorIds() {
 
         if ( != null) {
             return .getBehaviorIds();
         }
         return ..iterator();
         
     }

    

Register a new mapping of component type to the name of the corresponding javax.faces.component.UIComponent class. This allows subsequent calls to createComponent() to serve as a factory for javax.faces.component.UIComponent instances.

Parameters:
componentType The component type to be registered
componentClass The fully qualified class name of the corresponding javax.faces.component.UIComponent implementation
Throws:
java.lang.NullPointerException if componentType or componentClass is null
 
     public abstract void addComponent(String componentType,
                                       String componentClass);


    

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

Before the component instance is returned, it must be inspected for the presence of a javax.faces.event.ListenerFor (or javax.faces.event.ListenersFor) or ResourceDependency (or ResourceDependencies) annotation. If any of these annotations are present, the action listed in javax.faces.event.ListenerFor or ResourceDependency must be taken on the component, before it is returned from this method. This variant of createComponent must not inspect the javax.faces.render.Renderer for the component to be returned for any of the afore mentioned annotations. Such inspection is the province of createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String,java.lang.String) or createComponent(javax.faces.context.FacesContext,java.lang.String,java.lang.String).

Parameters:
componentType The component type for which to create and return a new javax.faces.component.UIComponent instance
Throws:
javax.faces.FacesException if a javax.faces.component.UIComponent of the specified type cannot be created
java.lang.NullPointerException if componentType is null
  
     public abstract UIComponent createComponent(String componentType)
         throws FacesException;



    

    

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

Deprecated:
This has been replaced by createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String).
Parameters:
componentBinding javax.faces.el.ValueBinding representing a component value binding expression (typically specified by the component attribute of a custom tag)
context javax.faces.context.FacesContext for the current request
componentType Component type to create if the javax.faces.el.ValueBinding does not return a component instance
Throws:
javax.faces.FacesException if a javax.faces.component.UIComponent cannot be created
java.lang.NullPointerException if any parameter is null
 
     public abstract UIComponent createComponent(ValueBinding componentBinding,
                                                 FacesContext context,
                                                 String componentType)
 	throws FacesException;

    

Call the getValue() method on the specified javax.el.ValueExpression. If it returns a javax.faces.component.UIComponent instance, return it as the value of this method. If it does not, instantiate a new javax.faces.component.UIComponent instance of the specified component type, pass the new component to the setValue() method of the specified javax.el.ValueExpression, and return it.

Before the component instance is returned, it must be inspected for the presence of a javax.faces.event.ListenerFor (or javax.faces.event.ListenersFor) or ResourceDependency (or ResourceDependencies) annotation. If any of these annotations are present, the action listed in javax.faces.event.ListenerFor or ResourceDependency must be taken on the component, before it is returned from this method. This variant of createComponent must not inspect the javax.faces.render.Renderer for the component to be returned for any of the afore mentioned annotations. Such inspection is the province of createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String,java.lang.String) or createComponent(javax.faces.context.FacesContext,java.lang.String,java.lang.String).

Parameters:
componentExpression javax.el.ValueExpression representing a component value expression (typically specified by the component attribute of a custom tag)
context javax.faces.context.FacesContext for the current request
componentType Component type to create if the javax.el.ValueExpression does not return a component instance
Throws:
javax.faces.FacesException if a javax.faces.component.UIComponent cannot be created
java.lang.NullPointerException if any parameter is null

A default implementation is provided that throws UnsupportedOperationException so that users that decorate Application can continue to function.

Since:
1.2
 
     public UIComponent createComponent(ValueExpression componentExpression,
                                        FacesContext context,
                                        String componentType)
     throws FacesException {
 
         if ( != null) {
             return .createComponent(componentExpression,
                                                       context,
                                                       componentType);
         }
 
         throw new UnsupportedOperationException();
 
     }


    

Like createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String) except the Renderer for the component to be returned must be inspected for the annotations mentioned in createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String) as specified in the documentation for that method. The Renderer instance to inspect must be obtained by calling javax.faces.context.FacesContext.getRenderKit() and calling javax.faces.render.RenderKit.getRenderer(java.lang.String,java.lang.String) on the result, passing the argument componentType as the first argument and the result of calling javax.faces.component.UIComponent.getFamily() on the newly created component as the second argument. If no such Renderer can be found, a message must be logged with a helpful error message. Otherwise, javax.faces.component.UIComponent.setRendererType(java.lang.String) must be called on the newly created UIComponent instance, passing the argument rendererType as the argument.

A default implementation is provided that throws UnsupportedOperationException so that users that decorate Application can continue to function.

Parameters:
componentExpression javax.el.ValueExpression representing a component value expression (typically specified by the component attribute of a custom tag)
context javax.faces.context.FacesContext for the current request
componentType Component type to create if the javax.el.ValueExpression does not return a component instance
rendererType The renderer-type of the Renderer that will render this component. A null value must be accepted for this parameter.
Throws:
javax.faces.FacesException if a javax.faces.component.UIComponent cannot be created
java.lang.NullPointerException if any of the parameters componentExpression, context, or componentType are null
Since:
2.0
 
     public UIComponent createComponent(ValueExpression componentExpression,
                                        FacesContext context,
                                        String componentType,
                                        String rendererType) {
 
         if ( != null) {
             return .createComponent(componentExpression,
                                                       context,
                                                       componentType,
                                                       rendererType);
         }
 
         throw new UnsupportedOperationException();
 
     }


    

Like createComponent(java.lang.String) except the Renderer for the component to be returned must be inspected for the annotations mentioned in createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String) as specified in the documentation for that method. The Renderer instance to inspect must be obtained by calling javax.faces.context.FacesContext.getRenderKit() and calling javax.faces.render.RenderKit.getRenderer(java.lang.String,java.lang.String) on the result, passing the argument componentType as the first argument and the result of calling javax.faces.component.UIComponent.getFamily() on the newly created component as the second argument. If no such Renderer can be found, a message must be logged with a helpful error message. Otherwise, javax.faces.component.UIComponent.setRendererType(java.lang.String) must be called on the newly created UIComponent instance, passing the argument rendererType as the argument.

A default implementation is provided that throws UnsupportedOperationException so that users that decorate Application can continue to function

.

Parameters:
context javax.faces.context.FacesContext for the current request
componentType Component type to create
rendererType The renderer-type of the Renderer that will render this component. A null value must be accepted for this parameter.
Throws:
javax.faces.FacesException if a javax.faces.component.UIComponent cannot be created
java.lang.NullPointerException if any of the parameters context, or componentType are null
Since:
2.0
 
     public UIComponent createComponent(FacesContext context,
                                        String componentType,
                                        String rendererType) {
 
         if ( != null) {
             return .createComponent(context,
                                                componentType,
                                                rendererType);
         }
 
         throw new UnsupportedOperationException();
 
     }


    

Instantiate and return a new javax.faces.component.UIComponent instance from the argument Resource. An algorithm semantically equivalent to the following must be followed to instantiate the UIComponent to return.

Before the component instance is returned, it must be inspected for the presence of a javax.faces.event.ListenerFor annotation. If this annotation is present, the action listed in javax.faces.event.ListenerFor must be taken on the component, before it is returned from this method.

A default implementation is provided that throws UnsupportedOperationException so that users that decorate Application can continue to function.

Parameters:
context javax.faces.context.FacesContext for the current request
componentResource A Resource that points to a source file that provides an implementation of a component.
Throws:
javax.faces.FacesException if a javax.faces.component.UIComponent from the Resource cannot be created
NullPointerException if any parameter is null
java.lang.NullPointerException if unable, for any reason, to obtain a ViewDeclarationLanguage instance as described above.
Since:
2.0
    public UIComponent createComponent(FacesContext context,
                                       Resource componentResource) {
        if ( != null) {
            return .createComponent(context,
                                                      componentResource);
        }
        throw new UnsupportedOperationException();
    }


    

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

    public abstract Iterator<StringgetComponentTypes();

    

Register a new mapping of converter id to the name of the corresponding javax.faces.convert.Converter class. This allows subsequent calls to createConverter() to serve as a factory for javax.faces.convert.Converter instances.

Parameters:
converterId The converter id to be registered
converterClass The fully qualified class name of the corresponding javax.faces.convert.Converter implementation
Throws:
java.lang.NullPointerException if converterId or converterClass is null
    public abstract void addConverter(String converterId
				      String converterClass);


    

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

Parameters:
targetClass The class for which this converter is registered
converterClass The fully qualified class name of the corresponding javax.faces.convert.Converter implementation
Throws:
java.lang.NullPointerException if targetClass or converterClass is null
    public abstract void addConverter(Class<?> targetClass,
                                      String converterClass);


    

Instantiate and return a new javax.faces.convert.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(java.util.TimeZone) must be called, passing the return from TimeZone.getDefault().

The argument converter must be inspected for the presence of the ResourceDependency annotation. If the ResourceDependency annotation is present, the action described in ResourceDependency must be taken. If the ResourceDependency annotation is not present, the argument converter must be inspected for the presence of the ResourceDependencies annotation. If the ResourceDependencies annotation is present, the action described in ResourceDependencies must be taken.

Parameters:
converterId The converter id for which to create and return a new javax.faces.convert.Converter instance
Throws:
javax.faces.FacesException if the javax.faces.convert.Converter cannot be created
java.lang.NullPointerException if converterId is null
    public abstract Converter createConverter(String converterId);


    

Instantiate and return a new javax.faces.convert.Converter instance of the class that has registered itself as capable of performing conversions for objects of the specified type. If no such javax.faces.convert.Converter class can be identified, return null.

To locate an appropriate javax.faces.convert.Converter class, the following algorithm is performed, stopping as soon as an appropriate javax.faces.convert.Converter class is found:

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.

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(java.util.TimeZone) must be called, passing the return from TimeZone.getDefault().

Parameters:
targetClass Target class for which to return a javax.faces.convert.Converter
Throws:
javax.faces.FacesException if the javax.faces.convert.Converter cannot be created
java.lang.NullPointerException if targetClass is null
    public abstract Converter createConverter(Class<?> targetClass);


    

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

    public abstract Iterator<StringgetConverterIds();

    
    

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

    public abstract Iterator<Class<?>> getConverterTypes();

    
    

Register a validator by its id that is applied to all UIInput components in a view. The validator to most often serve this role is the BeanValidator. The usage contract for this method assumes that the validator has been registered using the normal “by-id” registration mechanism.

An implementation is provided that takes no action so that users that decorate the Application continue to work.

Since:
2.0
    public void addDefaultValidatorId(String validatorId) {
        if ( != null) {
            .addDefaultValidatorId(validatorId);
        } 
    }


    

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

An implementation is provided that returns Collections.emptyMap so that users that decorate the Application continue to work.

Since:
2.0
        if ( != null) {
            return .getDefaultValidatorInfo();
        }
        return Collections.emptyMap();
    }


    

Return the javax.el.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.

Since:
1.2
        if ( != null) {
            return .getExpressionFactory();
        }
        throw new UnsupportedOperationException();
    }

    

Get a value by evaluating an expression.

Call getExpressionFactory() then call javax.el.ExpressionFactory.createValueExpression(java.lang.Object,java.lang.Class) passing the argument expression and expectedType. Call javax.faces.context.FacesContext.getELContext() and pass it to javax.el.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.

    public <T> T evaluateExpressionGet(FacesContext context,
                                       String expression,
                                       Class<? extends T> expectedTypethrows ELException {
        if ( != null) {
            return .evaluateExpressionGet(context,
                                                            expression,
                                                            expectedType);
        }
        throw new UnsupportedOperationException();
    }

    

Call getExpressionFactory() then call javax.el.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.

Deprecated:
This has been replaced by calling getExpressionFactory() then javax.el.ExpressionFactory.createMethodExpression(javax.el.ELContext,java.lang.String,java.lang.Class,java.lang.Class[]).
Parameters:
ref Method binding expression for which to return a javax.faces.el.MethodBinding instance
params 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
Throws:
java.lang.NullPointerException if ref is null
javax.faces.el.ReferenceSyntaxException if the specified ref has invalid syntax
    public abstract MethodBinding createMethodBinding(String ref,
                                                      Class<?> params[])
        throws ReferenceSyntaxException;


    

Return an Iterator over the supported Locales for this appication.

    public abstract Iterator<LocalegetSupportedLocales();


    

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

Parameters:
locales The set of supported Locales for this application
Throws:
java.lang.NullPointerException if the argument newLocales is null.
    public abstract void setSupportedLocales(Collection<Localelocales);

    

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.

Since:
1.2
    public void addELContextListener(ELContextListener listener) {
        if ( != null) {
            .addELContextListener(listener);
        } else {
            throw new UnsupportedOperationException();
        }
    }

    

Remove the argument listener from the list of javax.el.ELContextListeners. 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.

Since:
1.2
    public void removeELContextListener(ELContextListener listener) {
        if ( != null) {
            .removeELContextListener(listener);
        } else {
            throw new UnsupportedOperationException();
        }
    }

    

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.

Since:
1.2
        if ( != null) {
            return .getELContextListeners();
        }
        throw new UnsupportedOperationException();
    }


    

Register a new mapping of validator id to the name of the corresponding javax.faces.validator.Validator class. This allows subsequent calls to createValidator() to serve as a factory for javax.faces.validator.Validator instances.

Parameters:
validatorId The validator id to be registered
validatorClass The fully qualified class name of the corresponding javax.faces.validator.Validator implementation
Throws:
java.lang.NullPointerException if validatorId or validatorClass is null
    public abstract void addValidator(String validatorId
				      String validatorClass);


    

Instantiate and return a new javax.faces.validator.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 ResourceDependency annotation. If the ResourceDependency annotation is present, the action described in ResourceDependency must be taken. If the ResourceDependency annotation is not present, the argument validator must be inspected for the presence of the ResourceDependencies annotation. If the ResourceDependencies annotation is present, the action described in ResourceDependencies must be taken.

Parameters:
validatorId The validator id for which to create and return a new javax.faces.validator.Validator instance
Throws:
javax.faces.FacesException if a javax.faces.validator.Validator of the specified id cannot be created
java.lang.NullPointerException if validatorId is null
    public abstract Validator createValidator(String validatorId)
        throws FacesException;


    

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

    public abstract Iterator<StringgetValidatorIds();


    

Call getExpressionFactory() then call javax.el.ExpressionFactory.createValueExpression(java.lang.Object,java.lang.Class), passing the argument ref, Object.class for the expectedType, and null, for the fnMapper.

Deprecated:
This has been replaced by calling getExpressionFactory() then javax.el.ExpressionFactory.createValueExpression(java.lang.Object,java.lang.Class).
Parameters:
ref Value binding expression for which to return a javax.faces.el.ValueBinding instance
Throws:
java.lang.NullPointerException if ref is null
javax.faces.el.ReferenceSyntaxException if the specified ref has invalid syntax
    public abstract ValueBinding createValueBinding(String ref)
        throws ReferenceSyntaxException;


    

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. The implementation should be as fast as possible in determining whether or not a listener for the given systemEventClass and source has been installed, and should return immediately once such a determination has been made. The implementation of publishEvent must honor the requirements stated in subscribeToEvent(java.lang.Class,javax.faces.event.SystemEventListener) regarding the storage and retrieval of listener instances. Specifically, if subscribeToEvent(java.lang.Class,java.lang.Class,javax.faces.event.SystemEventListener) was called, the sourceClass argument must match exactly the Class of the source argument in the call to publishEvent(). The implementation must not do any inheritance hierarachy inspection when looking for a match between the sourceClass passed to subscribeToEvent(java.lang.Class,java.lang.Class,javax.faces.event.SystemEventListener) and the sourceClass passed to publishEvent() in order to find any listeners to which the event should be published. In the case where the Class of the source argument does not match the Class of the sourceClass used when the listener was subscribed using subscribeToEvent(), publishEvent(javax.faces.context.FacesContext,java.lang.Class,java.lang.Class,java.lang.Object) can be used to provide the Class used to perform the listener lookup and match.

The default implementation must implement an algorithm semantically equivalent to the following to locate listener instances and to invoke them.

If the act of invoking the processListener method causes an javax.faces.event.AbortProcessingException to be thrown, processing of the listeners must be aborted, no further processing of the listeners for this event must take place, and the exception must be logged with Level.SEVERE.

Algorithm traverseListenerList: For each listener in the list,

A default implementation is provided that throws UnsupportedOperationException so that users that decorate Application can continue to function

.

Parameters:
context the FacesContext for the current request
systemEventClass The Class of event that is being published.
source The source for the event of type systemEventClass.
Throws:
java.lang.NullPointerException if either context, systemEventClass or source is null
Since:
2.0
    public void publishEvent(FacesContext context,
                             Class<? extends SystemEventsystemEventClass,
                             Object source) {
        if ( != null) {
            .publishEvent(contextsystemEventClasssource);
        } else {
            throw new UnsupportedOperationException();
        }
    }

    

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

A default implementation is provided that throws UnsupportedOperationException so that users that decorate Application can continue to function

.

Parameters:
context the FacesContext for the current request
systemEventClass The Class of event that is being published.
sourceBaseType 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.
source The source for the event of type systemEventClass.
Throws:
java.lang.NullPointerException if any arguments except for sourceBaseType are null
Since:
2.0
    public void publishEvent(FacesContext context,
                             Class<? extends SystemEventsystemEventClass,
                             Class<?> sourceBaseType,
                             Object source) {
        if ( != null) {
            .publishEvent(context,
                                            systemEventClass,
                                            sourceBaseType,
                                            source);
        } else {
            throw new UnsupportedOperationException();
        }
    }



    

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.

If argument sourceClass is non-null, sourceClass and systemEventClass must be used to store the argument listener in the application in such a way that the listener can be quickly looked up by the implementation of publishEvent(javax.faces.context.FacesContext,java.lang.Class,java.lang.Object) given systemEventClass and an instance of the Class referenced by sourceClass. If argument sourceClass is null, the listener must be discoverable by the implementation of publishEvent(javax.faces.context.FacesContext,java.lang.Class,java.lang.Object) given only systemEventClass.

Parameters:
systemEventClass the Class of event for which listener must be fired.
sourceClass the Class of the instance which causes events of type systemEventClass to be fired. May be null.
listener the implementation of javax.faces.event.SystemEventListener whose javax.faces.event.SystemEventListener.processEvent(javax.faces.event.SystemEvent) method must be called when events of type systemEventClass are fired.
Throws:
NullPointerException if any combination of systemEventClass, or listener are null.
Since:
2.0
    public void subscribeToEvent(Class<? extends SystemEventsystemEventClass,
                                 Class<?> sourceClass,
                                 SystemEventListener listener) {
        if ( != null) {
            .subscribeToEvent(systemEventClass,
                                                sourceClass,
                                                listener);
        } else {
            throw new UnsupportedOperationException();
        }
    }


    

Install the listener instance referenced by argument listener into application as a listener for events of type systemEventClass. The default implementation simply calls through to subscribeToEvent(java.lang.Class,java.lang.Class,javax.faces.event.SystemEventListener) passing null as the sourceClass argument

A default implementation is provided that throws UnsupportedOperationException so that users that decorate Application can continue to function

.

Parameters:
systemEventClass the Class of event for which listener must be fired.
listener the implementation of javax.faces.event.SystemEventListener whose javax.faces.event.SystemEventListener.processEvent(javax.faces.event.SystemEvent) method must be called when events of type systemEventClass are fired.
Throws:
NullPointerException if any combination of systemEventClass, or listener are null.
Since:
2.0
    public void subscribeToEvent(Class<? extends SystemEventsystemEventClass,
                                 SystemEventListener listener) {
        if ( != null) {
            .subscribeToEvent(systemEventClasslistener);
        } else {
            throw new UnsupportedOperationException();
        }
    }


    

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. See subscribeToEvent(java.lang.Class,java.lang.Class,javax.faces.event.SystemEventListener) for the specification of how the listener is stored, and therefore, how it must be removed.

Parameters:
systemEventClass the Class of event for which listener must be fired.
sourceClass the Class of the instance which causes events of type systemEventClass to be fired. May be null.
listener the implementation of javax.faces.event.SystemEventListener to remove from the internal data structure.
Throws:
NullPointerException if any combination of context, systemEventClass, or listener are null.
Since:
2.0
    public void unsubscribeFromEvent(Class<? extends SystemEventsystemEventClass,
                                     Class<?> sourceClass,
                                     SystemEventListener listener) {
        if ( != null) {
            .unsubscribeFromEvent(systemEventClass,
                                                    sourceClass,
                                                    listener);
        } else {
            throw new UnsupportedOperationException();
        }
    }


    

Remove the listener instance referenced by argument listener from the application as a listener for events of type systemEventClass. The default implementation simply calls through to unsubscribeFromEvent(java.lang.Class,javax.faces.event.SystemEventListener) passing null as the sourceClass argument

Parameters:
systemEventClass the Class of event for which listener must be fired.
listener the implementation of javax.faces.event.SystemEventListener to remove from the internal data structure.
Throws:
NullPointerException if any combination of context, systemEventClass, or listener are null. http://java.sun.com/javaee/javaserverfaces/reference/api/index.html
Since:
2.0
    public void unsubscribeFromEvent(Class<? extends SystemEventsystemEventClass,
                                     SystemEventListener listener) {
        if ( != null) {
            .unsubscribeFromEvent(systemEventClasslistener);
        } else {
            throw new UnsupportedOperationException();
        }
    }
New to GrepCode? Check out our FAQ X