
Deploying JSF Portlets on Jetty
Overview #
In order to deploy JSF portlets on any server, it is necessary to have the Mojarra ConfigureListener and Liferay Faces BridgeSessionListener startup during context initialization. On Jetty 8/9, this can be accomplished with either manual configuration, or automatic configuration.
Manual Configuration #
In order to manually configure the listeners, add the following to the WEB-INF/web.xml descriptor of your portlet WAR projects:
<listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> <listener> <listener-class>com.liferay.faces.bridge.servlet.BridgeSessionListener</listener-class> </listener>
Automatic Configuration #
If you prefer automatic configuration (zero-config), then follow these steps:
Step 1: Enable the "annotations" feature of Jetty by adding the following bold text to the $JETTY_HOME/bin/start.ini file:
OPTIONS=Server,jsp,resources,plus,annotations
../etc/jetty.xml
../etc/jetty-deploy.xml
../etc/jetty-webapps.xml
../etc/jetty-contexts.xml
../etc/jetty-annotations.xml
Option A: Mojarra in Global Class Path
If you would like to include Mojarra in the Jetty global class path, then you will need to copy the Mojarra jsf-api.jar and jsf-impl.jar dependencies to the $JETTY_HOME/lib/jsp folder. The Mojarra ConfigureListener will be automatically started by Jetty.
Option B: Mojarra in Webapp Class Path
If you would prefer to include Mojarra in the Webapp class path, then you must include the liferay-faces-init.jar dependency in your WEB-INF/lib folder in order for the Mojarra ConfigureListener to be automatically started by Jetty:
<dependency> <groupId>com.liferay.faces</groupId> <artifactId>liferay-faces-init</artifactId> <version>3.1.3-ga4</version> </dependency>
ICEfaces and RichFaces Resources #
As described in FACES-1856 (ICEfaces on Jetty) and FACES-1611 (RichFaces on Jetty), it is necessary to add the following to the $JETTY_HOME/etc/jetty.xml descriptor:
<Set class="org.eclipse.jetty.util.resource.Resource" name="defaultUseCaches">false</Set>
JSP (Non-Facelets) #
If you are using JSP as your JSF view technology (rather than Facelets) then you will need to copy the Mojarra jsf-api.jar and jsf-impl.jar dependencies to the $JETTY_HOME/lib/jsp folder.
See Also: