Foundation
Project Documentation

Dependencies

Dependencies of Apache Trinidad include:

  • Java 5
  • Either the JSF 1.1 reference implementation or later or MyFaces 1.0.8 or later, and their respective dependencies.

Deliverables

The Apache Trinidad deliverables are:

  • trinidad-api-1.0.1-SNAPSHOT.jar: public APIs of Apache Trinidad, all in the org.apache.myfaces.trinidad package
  • trinidad-impl-1.0.1-SNAPSHOT.jar: private APIs of Apache Trinidad, all in the org.apache.myfaces.trinidadinternal package

Developers are strongly encouraged to compile against the Trinidad API JAR only - this will ensure that you are only using public APIs.

General Installation

Apache Trinidad is designed to run on any J2EE-compliant application server. To install Apache Trinidad outside of a JDeveloper-based environment, take the following steps:

  1. Install either JSF 1.1.01 reference implementation or MyFaces 1.0.8 or later, and their respective dependencies. Please consult your application server provider for documentation on this step.
  2. Install the Apache Trinidad libraries and dependencies in WEB-INF/lib.
  3. Register the Apache Trinidad filter in your WEB-INF/web.xml:
      <filter>
        <filter-name>trinidad</filter-name>
        <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
      </filter>
    
      <filter-mapping>
        <filter-name>trinidad</filter-name>
        <!-- This assumes that the FacesServlet has been registered -->
        <!-- under the name "faces" -->
        <servlet-name>faces</servlet-name>
      </filter-mapping>
    
    
  4. Tell JSF to use the Apache Trinidad RenderKit by adding the following to your faces-config.xml:
      <application>
        <default-render-kit-id>
          org.apache.myfaces.trinidad.core
        </default-render-kit-id>
      </application>
    
    
  5. Register the ResourceServlet that would be used for serving the resources at runtime(images, javascripts and styles):
     <servlet>
      <servlet-name>resources</servlet-name>
      <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
     </servlet>
    
    <!-- This cannot be configured currently -->
    <servlet-mapping>
        <servlet-name>resources</servlet-name>
        <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>
    
    
    
    

In addition, it is strongly recommended that you enable client-side state saving, again in WEB-INF/web.xml. Apache Trinidad offers a much improved version of client-side state saving that is a significant improvement over standard server-side state saving. State is still saved in the HttpSession, but a token is sent to the client to disambiguate instances of a page, and session-based state is serializable to support failover.

  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>

Finally, if you plan on using Facelets, you should add the following items to your WEB-INF/web.xml.

  <context-param>
    <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
    <!-- TrinidadFaceletViewHander must be the alternate view handler if SessionChangeManager is used -->
    <param-value>org.apache.myfaces.trinidadinternal.facelets.TrinidadFaceletViewHandler</param-value>
  </context-param>

  <context-param>
    <!--Unfortunately, Facelets provides no hook for plugging the PageResolver into the logic 
      handling "facelets.VIEW_MAPPINGS". You should leave "facelets.VIEW_MAPPINGS" 
      unset and use "org.apache.myfaces.trinidad.FACELETS_VIEW_MAPPINGS" instead.-->
    <param-name>org.apache.myfaces.trinidad.FACELETS_VIEW_MAPPINGS</param-name>
    <param-value>*.xhtml</param-value>
  </context-param>

Make sure to also remove the default com.sun.facelets.FaceletViewHandler from your faces-config.xml. Trinidad comes with its own ViewHandler which needs to be invoked in the correct order with the Facelet specific ViewHandler noted above. If you specified the alternative view handler parameter as described above, it will be called by the Apache Trinidad ViewHandler at the right time. Note that if Session based change persistence is not used, com.sun.facelets.FaceletViewHandler or any of its custom extensions can be set as the alternate view handler. For information about enabling Change Persistence feature, please see the 'Configuring Apache Trinidad' developer guide chapter.

Configuration for Development

If you are an application developer, there are

Demos

The demos are available in trinidad-demo.war.

One of the demos allows you to check email. If you are not running in a J2EE 1.3 (or higher) server you will need to add the jars listed below to adf-faces-demo/WEB-INF/lib.

  • JavaMail - go to download button for "Download JavaMail API Implementation Version 1.2 " and download 'javamail-1_2.zip'. Extract the jar:
    • mail.jar
  • JavaBeans Activation Framework - go to the download button and download 'jaf-1_0_2-upd.zip'. Extract the jar:
    • activation.jar

To access the demos, start at index.jspx.