CDI Portlet Predefined Beans¶
Liferay DXP provides injectable portlet artifacts for CDI called Portlet Predefined Beans, as specified by JSR 362. There are two types of predefined beans:
Portlet Request Scoped Beans (
@PortletRequestScoped
Dependent Scoped Beans (
@Dependent
scoped)
The table below describes these attributes for each bean:
Artifact: The bean’s type.
Bean EL Name: Expression Language (EL) name for accessing the bean in a JSP or JSF page.
Qualifier: Annotation applied to the bean for defining and selecting a bean implementation.
Valid during (phase): The portlet phases in which the bean is valid.
Portlet Request Scoped Beans¶
These beans have the @PortletRequestScoped
annotation. Here are their artifact types, bean EL names, and annotation qualifiers, along with their valid portlet phases.
Table 1: Portlet Request Scoped Beans1
Artifact |
Bean EL Name |
Qualifier |
Valid during |
---|---|---|---|
|
|
- |
all |
|
|
- |
all |
|
|
- |
all |
|
|
- |
action |
|
|
- |
action |
|
|
- |
header |
|
|
- |
header |
|
|
- |
render |
|
|
- |
render |
|
|
- |
event |
|
|
- |
event |
|
|
- |
resource |
|
|
- |
resource |
|
|
- |
action, event |
|
|
- |
header, render, resource |
|
|
- |
action, resource |
|
|
- |
all |
|
|
- |
action, event |
|
|
- |
action |
|
|
- |
resource |
|
|
- |
all |
|
|
- |
all |
|
|
- |
all |
|
|
- |
all |
|
|
- |
all |
|
|
- |
all |
|
|
- |
all |
Dependent Scoped Beans¶
These beans use the @Dependent
scope. They’re of type java.lang.String
, which is final
. This disqualifies them from being proxied. To prevent using dependent scoped beans in a scope broader than their original scope, you should only inject them into @PortletRequestScoped
beans.
Table 2: Dependent Scoped Beans2
Artifact |
Bean EL Name |
Qualifier |
Valid during |
---|---|---|---|
|
|
|
all |
|
|
|
all |
|
|
|
all |
|
|
|
all |