Receives notification that a session was created, and adds newly
created cache for JSP tag body invocations as a session attribute.
HttpSession session = hse.getSession();
ServletContext context = session.getServletContext();
// Check if a cache manager has already been created and set in the
// context
CacheManager cm = (CacheManager)
context.getAttribute(CacheManager.CACHE_MANAGER_ATTR_NAME);
// Create a new cache manager if one is not present and use it
// to create a new cache
if (cm == null) {
cm = new CacheManager();
}
Cache cache = null;
try {
cache = cm.createCache();
} catch (Exception ex) {}
// Set the cache as a session attribute
if (cache != null) {
session.setAttribute(Constants.JSPTAG_CACHE_KEY, cache);
}