Internet Insight: Right Way to Build Dynamic Content
Once a company decides to distribute its dynamic content, it has to put mechanisms in place to ensure proper page creation. The ESI specification includes features to help ensure that page information is updated correctly.
The markup language starts off by outlining how each Web page should be composed. Each file is subject to its own configuration and control, its own time period to be stored in cache, and various revalidation instructions.
Edge Side Includes provides a couple of conditions to determine how to look for updated information. A conditional inclusion feature is based on application comparisons or environmental variables, such as cookie information. Cookie information identifies incoming users, so if someone has been to a site before and shown an interest in stock quotes, for example, that person can be pointed toward stock quotes again. These variables can be used inside ESI programming statements or on the outside of ESI blocks.
Also, the standards exception and error-handling functions allow developers to specify alternative pages and default behavior in the event that an origin site or document is not available. An explicit exception-handling statement outlines how a server should respond when a severe system or network problem occurs.
Due to the unpredictable nature of frequently changing content, ESI also includes a content invalidation specification. This specification is used by syndication servers, content management systems, databases, custom scripts and application logic to send HTTP messages to the appropriate cache. The invalidation message tells the cache or delivery network to overwrite the metadata (the information about where data is stored) associated with particular objects residing on edge servers.
Integrated into an application server, the invalidation specification allows for the purging of outdated or undesired content from a local cache or a content delivery network. A database trigger, a script or another piece of code can set off this process. When a catalog item is flagged in the database, it is no longer viewable on the Web site.
JESI (Edge Side Includes for Java) are extensions to the Java programming language that enable JSP (JavaServer Pages) to call ESI components. JESI supports two usage models: one for new JSP pages and another for existing pages. With the former, a developer can divide a page into independent JSP fragments and indicate how these JSP fragments are to be assembled into an aggregated page. An Includes command declares in templates where fragments will be inserted during the page building, and a control command outlines templates and fragment attributes such as an expiration date. In addition, ESIs parameter item specifies any additional considerations, and the code-block command declares a code block to be executed during template generation. These different functions help ensure that a Web site presents accurate dynamic information from many sources to interested users.