Context Standard Plugin: FaceplaitPlugin
The FaceplaitPlugin is a standard context plugin that provides the exact functionality of the org.cfcommons.faceplait module libary in the form of an HTTPPlugin. This makes implementing the Faceplait layouts management library within an HTTPContext very easy.
Plugin Initialization
The plugin itself requires only one initialization parameter, layoutsdirectory. The value of this initialization parameter can be an absolute path to a system directory that contains your layouts, or it can be a relative path from the web-root in which case the plugin will attempt to resolve the full system path on its own. It's always better to provide a full system path so as to eliminate any ambiguity regarding layout location, however providing the relative path can be more flexible;
Of course as with all plugins, you can also programmatically initialize this plugin providing the same initialization parameter;
Order Matters
At the end of the day, the FaceplaitPlugin is a type of response filter. It takes whatever response has been produced by the HTTPPlugin chain of responsibility and attempts to decorate the final response with a layout. It's very picky however, it will only attempt to decorate content that is valid HTML. Any other response type will be ignored. In order to accomplish this task, you as the developer will need to ensure that the FaceplaitPlugin is the last registered HTTPPlugin within a context. Below is a sample context configuration file which properly places Faceplait as the last registered plugin;
...and the programmatic example;