4.2. RichFaces Architecture Overview

The following figure lists several important elements of the RichFaces Framework.
Core AJAX component structure

Figure 4.2. Core AJAX component structure

AJAX Filter.

To make the most of RichFaces, you should register a Filter in your application's web.xml. The Filter recognizes multiple request types. The sequence diagram in Figure 5.3 shows the differences in processing between a regular JSF request and an AJAX request.

Request processing sequence diagram

Figure 4.3. Request processing sequence diagram

In either case, the required static or dynamic resource information that your application requests is registered in the ResourceBuilder class.
When a resource request is issued, the RichFaces filter checks the Resource Cache for this resource. If it is present, the resource is returned to the client. Otherwise, the filter searches for the resource among those registered in the ResourceBuilder. If the resource is registered, the RichFaces filter requests that the ResourceBuilder creates (delivers) the resource.
The diagram that follows illustrates the process of requesting a resource.
Resource request sequence diagram

Figure 4.4. Resource request sequence diagram

AJAX Action Components

AJAX Action components are used to send AJAX requests from the client side. There are a number of AJAX Action components, including <a4j:commandButton>, <a4j:commandLink>, <a4j:poll>, and <a4j:support>.

AJAX Containers

AjaxContainer is an interface that defines an area on your JSF page that should be decoded during an AJAX request. AjaxViewRoot and AjaxRegion are both implementations of this interface.

JavaScript Engine

The RichFaces JavaScript Engine runs on the client side, and updates different areas of your JSF page based on information from the AJAX response. This JavaScript code operates automatically, so there is no need to use it directly.