Rendering Pipeline

This pertains to uPortal 3.3 and later

Rendering Pipeline Overview

The rendering pipeline uses a combination of Streaming APIs for XML (StAX) and a custom Character Streaming API which mimics the StAX APIs but handles character and portal specific data. The rendering pipeline is comprised of small components each with a specific function. These components use a common input and output API allowing the runtime pipeline to be easily modified. Also all components are cache aware and can return a CacheKey that represents their current state for a request. This allows caching components to short-circuit the rendering pipeline when the output from a lower-level component is already in cache.

Technologies

Streaming APIs for XML (StAX)

The Java StAX API provides a pull based XML eventing system. XML is parsed into events which are retrieved via a specialized XMLEventReader which extends the Iterator interface. This design allows for easy filtering by applying custom wrappers to the XMLEventReader to inject, modify, or remove events from the stream.

Streaming APIs for Characters (StAC)

StAC isn't really a standard, it is an in-spirit clone of the StAX design but meant to handle character and portal events. With the asynchronous way that uPortal renders portlets the actual output from those portlets isn't injected into the actual page until the very end of the rendering pipeline. Placeholder elements and attributes are left in the XML stream marking where the output of a portlet, the portlet's title or other dynamic information should be included. When serializing the XML stream into a string these placeholders are used to chunk the data into character events with placeholder events being added in between. This approach allows the character data to be cached and replayed even though the portlet content may be changing.

Key Components

While the rendering pipeline has over 17 components there are only a few that are really interesting.

XSLTComponent

Generic XSLT engine that works with StAX XMLEvent streams. The XSL Template is provided via an injected TransformerSource and a TransformerConfigurationSource can be injected to provide properties and parameters to the Transformer. There are structure and theme specific implementations of these interfaces that allow the same XSLTComponent to be re-used for each needed XSL Transformation in the pipeline.

StAXSerializingComponent

Handles the conversion from XML events to String data using the StAX OutputFactory APIs. A custom XMLEventReader is used to watch for placholder events and markers in the string data and chunk the output into character events.

Logging

Caching

Detailed Pipeline Diagram

The diagram below represents the actual default uPortal rendering pipeline configuration.