protected void setupContainer(HttpServletRequest request) { ComponentManager container = null; HttpSession session = request.getSession(false); ComponentManager fallback = null; if (session != null) { fallback = (ComponentManager) session.getAttribute(ComponentManager.COMPONENT_MANAGER_KEY); } ServletContext servletContext = getServletContext(session); if (fallback == null) { fallback = (ComponentManager) servletContext.getAttribute(ComponentManager.COMPONENT_MANAGER_KEY); } if (fallback != null) { container = createComponentManager(); container.setFallback(fallback); } ComponentConfiguration config = (ComponentConfiguration) servletContext.getAttribute("ComponentConfiguration"); if (config != null) { if (container == null) { container = createComponentManager(); } config.configure(container, "request"); request.setAttribute(ComponentManager.COMPONENT_MANAGER_KEY, container); } }