Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

The JSF module provides additional features like new scopes and it improves existing JSF mechanisms.

Overview

Scopes

Grouped Conversation Scope

CDI conversations are very limited. Therefore CODI provides grouped conversations which are similar to the conversations of MyFaces Orchestra. Compared to std. CDI conversations CODI provides completely different conversation concepts. "Just the name is the same." Every conversation scoped bean (or a group of beans) has/have a conversation. So it's possible to have multiple conversations in parallel (in the same window) with a different lifetime. Optionally you can use a fine grained memory management. You can easily just end the conversation of a single bean (or a group of conversation scoped beans) or all conversations within the current window.

View Access Scope

Normally you have to terminate conversations manually (or they will be terminated automatically after a timeout). However, sometimes you need beans with a lifetime which is as long as needed and as short as possible which are terminated automatically (as soon as possible). In such an use-case you can use this scope. The simple rule is, as long as the bean is referenced by a page - the bean will be available for the next page (if it's used again the bean will be forwarded again).

Window Scope

This scope is comparable with a session per window. It is useful for beans which contain e.g. preferences of the current user.

View Scope (JSF 2+ only)

CODI allows using all CDI mechanisms for the new view scope of JSF 2.

Dependency Injection

CODI allows using @Inject within the following JSF artifacts:

  • Converter
  • Validator
  • PhaseListener

Life-cycle Annotations

Phase-Listener Methods

Sometimes you don't need a full Phase-Listener. So CODI allows to annotate individual methods. Furthermore, it's possible to link those methods to special views.

Phase-Listener

JSF itself doesn't provide an annotation for phase-listeners. CODI provides such an annotation. Furthermore, CODI provides an optional annotation to define the invocation order of phase-listeners.

Faces-Request-Listener

Methods annotated with these annotations are invoked before and after a faces-request. In comparison to similar mechanisms, the FacesContext is available for the listener.

Producers

Producers for JSF artifacts

  • FacesContext

Producers for CODI artifacts

  • WindowContextManager
  • WindowContext
  • Conversation
  • MessageContext

Type-safe View Config

View configs are the base mechanism for type-safe navigation and further concepts like page-beans. It's planned to add further features based on this type-safe config approach.

Type-safe Navigation

Instead of using strings as outcome, it's possible to link a page to a special config class. So it's possible to use these classes as return values for action methods.

PreViewConfigNavigateEvent

In case of type-safe navigation it's possible to observe navigations which have a view-config for the source-view as well as the target-view.
Furthermore, it's possible to change the navigation target.

Type-safe Security

It's possible to define permissions per method, bean, page or group of pages. You can use a custom implementation or an adapter to integrate an external security framework.

JsfLifecyclePhaseInformation

Helper for detecting the current phase of the JSF request lifecycle.

RequestTypeResolver

It's mainly for used internally. However, you can use it to easily detect the type of the current request and it's possible to plugin a custom implementation which gets used by the framework.

Qualifiers

Dependencies

The page CODI Modules provides an overview about CODI modules and how to add them to your project.

For using the features described in JSF Usage, you have to add:

  • CODI-Core
  • CODI-JSF module (for the JSF version you are using)
  • CODI-Message- and BV-Module
  • JSF implementation of your choice

Compatibility

This module is tested with JSF 1.2, 2.0 and 2.1

Details

Further details related to this module are available at:

...