InfoGrid includes a templating framework for HTML and other composite document output.
Its core class is the TemplatesFilter, which needs to be part of the servlet FilterChain. It performs the following actions:
- Creates a StructuredResponse, and adds it to the incoming ServletRequest as an attribute
- Processes the FilterChain, buffering the generated output. If the Viewlet Framework is being used, this will execute the appropriate Viewlet. If the remaining FilterChain is aware of the Html Templates (such as the Viewlet Framework), it will populate the StructuredResponse instead of producing output directly.
- Report any generated exceptions to the StructuredResponse.
- Create the applicable StructuredResponseTemplate from the applications's StructuredResponseTemplateFactory.
- Apply the StructuredResponseTemplate to the StructuredResponse, thereby producing the output that is returned in response to the HTTP request. This is the actual formatting step that translates a structured representation of the response into serialized output, such as HTML.