{
ServletContext ctxt = getServletContext();
/* Initialize the Command chain and add the ErrorCRI */
Chain xhrServletCommand = null;
CatalogConfig catalogConfig = ConfigUtil.getConfig().getCatalogConfig();
if(catalogConfig != null) {
/*
todo: neaten up this initialization process. because of the separation between
parsing and configuration, this is a second step.
Need to put this somewhere in the framework, preferably in a single
place that initializes the PageFlow runtime.
*/
CatalogFactory catalogFactory = CatalogFactory.getInstance();
if(catalogFactory.getCatalog() == null)
catalogFactory = CatalogFactory.getInstance(catalogConfig);
assert catalogFactory != null;
Catalog catalog = catalogFactory.getCatalog();
if(catalog != null) {
xhrServletCommand = (Chain)catalog.getCommand(COMMAND_XHR);
}
if(xhrServletCommand != null) {
xhrServletCommand.addCommand(new ErrorCRI());
}
}
/*
For compatibility, add the ErrorCRI to the list of global Interceptors only if the