CofaxServlet - a presentation class for web delivery
CofaxServlet utilizes the Cofax framework to present content. It can be replaced with programs in other environments that can take advantage of objects written in Java, for example, Microsoft's Active Server Pages.
Performs delivery of content, dictated by the request, from cache if available.
Objects accessed beyond configured counts are cached and refreshed in CofaxCache at configured intervals or when changed by editors tools. If a content object to return is cached, it is returned immediately and processing ends here.
Performs delivery of request dynamically.
When objects are first requested, or force-refreshed, or expired, from cache, objects are assembled from the request and retured.
Builds and utilizes a glossary.
A glossary is a user accessable hashtable of key/value pairs. A variable space. The glossary values are used throughout the course of content assembly and can be modified/added to within the template, either manually or through packageTag requests, via QueryString, Form values, and the requesting URL. Variable names are prefixed with a namespace designating their originator. For example, glossary values added specifically from the request are prefixed with "request:".
Some example glossary entries:
request:section = sports
request:date = 2000/06/01
request:publication = inquirer
request:url = http://inq.philly.com/content/inquirer/2000/06/01/sports/
request:server = inq.philly.com
request:host = inq.philly.com
plus much more....
Picks a template from template cache or dynamically.
Instantiates a TemplateProcessor that contains logic on template parsing and picking. Instantiates a DataStore that provides processing for packageTags and packageTags.
Templates are cached in CofaxServlet when first used. Cached templates are refreshed if changed.
When loading a new template, TemplateProcessor is given the request data and determines which template to use and loads it.
Adds to or modifies the glossary from template packageTag requests.
TemplateProcessor collects packageTags from the template, and using DataStore, adds to or modifies glossary entries. packageTags are pre-defined DataStore requests that return a single hashtable of key/value pairs. If multiple rows are returned from the data store, all except the last row are ignored. packageTags are NOT defined within the DataStore object, but with the actual data store itself. This provides complete abstraction from the program. Someone familiar with the data store can add new packageTags quickly and easily, in the context of that data store. The glossary can be used as parameters in packageTag requests. The action is sequential. An earlier packageTag request can pull data that a later packageTag request requires.
The designer can override or add new glossary entries at this point by adding the tag name and value within a packageTag as a parameter.
Parses the template with glossary data.
In accordance with the patterns defined in the TemplateProcessor, glossary data is parsed into the template where the designer has put the proper tags.
Collects and processes packageTags from template requests.
TemplateProcessor collects packageTags from the template, and using DataStore, returns packageData. These packageTags return multiple rows and utilize a block of template designer defined formatting code for the output of those rows.
Parses the template with package data.
Utilizing the format code defined in the template's packageTag block, rows are parsed into the template in accordance with the patterns defined in the TemplateProcessor.
Caches the content if meeting configured requirements.
If the parsed content now meets configured requirements CofaxServlet will utilize CofaxCache to store the page for faster retrieval in the future.
Returns the content.