Integration of CDI into portlets

Parent POM for JBoss projects. Provides default project build configuration.

License

License

GroupId

GroupId

org.gatein
ArtifactId

ArtifactId

cdi-portlet-integration
Last Version

Last Version

1.0.3.Final
Release Date

Release Date

Type

Type

jar
Description

Description

Integration of CDI into portlets
Parent POM for JBoss projects. Provides default project build configuration.
Project Organization

Project Organization

JBoss by Red Hat
Source Code Management

Source Code Management

https://github.com/portletbridge/cdi-portlet-integration

Download cdi-portlet-integration

How to add to project

<!-- https://jarcasting.com/artifacts/org.gatein/cdi-portlet-integration/ -->
<dependency>
    <groupId>org.gatein</groupId>
    <artifactId>cdi-portlet-integration</artifactId>
    <version>1.0.3.Final</version>
</dependency>
// https://jarcasting.com/artifacts/org.gatein/cdi-portlet-integration/
implementation 'org.gatein:cdi-portlet-integration:1.0.3.Final'
// https://jarcasting.com/artifacts/org.gatein/cdi-portlet-integration/
implementation ("org.gatein:cdi-portlet-integration:1.0.3.Final")
'org.gatein:cdi-portlet-integration:jar:1.0.3.Final'
<dependency org="org.gatein" name="cdi-portlet-integration" rev="1.0.3.Final">
  <artifact name="cdi-portlet-integration" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.gatein', module='cdi-portlet-integration', version='1.0.3.Final')
)
libraryDependencies += "org.gatein" % "cdi-portlet-integration" % "1.0.3.Final"
[org.gatein/cdi-portlet-integration "1.0.3.Final"]

Dependencies

provided (2)

Group / Artifact Type Version
javax.portlet : portlet-api jar 2.0
javax.servlet : javax.servlet-api jar 3.0.1

Project Modules

There are no modules declared in this project.

CDI Portlet Integration

What is this?

This library contains one Portlet Filter that wraps Portlet Request objects with HttpServletRequest so that CDI will work within a JSF portlet that uses a JSF Bridge. It also contains a second filter that wraps both Portlet Request and Response objects, for when you need CDI to operate on the request and response objects.

Configuration

To enable this integration for your JSF portlet, simply add the following filter definition into your portlet.xml:

<filter>
    <filter-name>PortletCDIFilter</filter-name>
    <filter-class>org.gatein.cdi.PortletCDIFilter</filter-class>
    <lifecycle>ACTION_PHASE</lifecycle>
    <lifecycle>EVENT_PHASE</lifecycle>
    <lifecycle>RENDER_PHASE</lifecycle>
    <lifecycle>RESOURCE_PHASE</lifecycle>
</filter>
<filter-mapping>
    <filter-name>PortletCDIFilter</filter-name>
    <portlet-name>[Name of your portlet as defined in portlet-name]</portlet-name>
</filter-mapping>

The above example uses the filter that wraps Portlet Request objects only. If you want to use the filter that wraps Portlet response objects as well, change the filter-class tag content to org.gatein.cdi.PortletCDIResponseFilter.

What is supported

The following CDI Scopes are currently supported within a JSF portlet using this library:

  • @ApplicationScoped
  • @SessionScoped
  • @ConversationScoped for long running conversations

@ConversationScoped (transient conversations)

Transient conversations are not supported within a JSF portlet as they are initialized at the commencement of the ActionRequest and RenderRequest, so any beans that had data saved during ActionRequest will be reset when RenderRequest commences.

@RequestScoped

@RequestScoped is not supported within a JSF portlet as the concept of a ServletRequest (for JSF) and a PortletRequest have very different lifecycles. This results in any @RequestScoped beans being initialized at the commencement of any PortletRequest, with no way to retain data between them.

org.gatein

Portlet Bridge

Versions

Version
1.0.3.Final
1.0.2.Final
1.0.1.Final
1.0.0.Final
1.0.0.Alpha2
1.0.0.Alpha1