public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; /* HST and ClientComponentManager initialization */ contextNamespace = getConfigOrContextInitParameter(CONTEXT_NAMESPACE_INIT_PARAM, contextNamespace); clientComponentManagerClassName = getConfigOrContextInitParameter(CLIENT_COMPONENT_MANAGER_CLASS_INIT_PARAM, clientComponentManagerClassName); String param = getConfigOrContextInitParameter(CLIENT_COMPONENT_MANAGER_CONFIGURATIONS_INIT_PARAM, null); if (param != null) { String [] configs = param.split(","); for (int i = 0; i < configs.length; i++) { configs[i] = configs[i].trim(); } clientComponentManagerConfigurations = configs; } clientComponentManagerContextAttributeName = getConfigOrContextInitParameter(CLIENT_COMPONENT_MANAGER_CONTEXT_ATTRIBUTE_NAME_INIT_PARAM, clientComponentManagerContextAttributeName); initialized = false; if (HstServices.isAvailable()) { doInit(filterConfig); } }
/** * This returns the client ComponentManager if one is configured with its default name. If set on the context with a different * attribute name, you need to fetch it yourself with a different attr name * @return the client ComponentManager or <code>null</code> if none configured */ public ComponentManager getDefaultClientComponentManager(){ ComponentManager clientComponentManager = HstFilter.getClientComponentManager(getServletContext()); if(clientComponentManager == null) { log.warn("Cannot get a client component manager from servlet context for attr name '{}'", HstFilter.CLIENT_COMPONENT_MANANGER_DEFAULT_CONTEXT_ATTRIBUTE_NAME); } return clientComponentManager; }
private String getConfigOrContextInitParameter(String paramName, String defaultValue) { String value = getInitParameter(filterConfig, filterConfig.getServletContext(), paramName, defaultValue); return (value != null ? value.trim() : null); }
if (isCrossContextInclude(req)) { chain.doFilter(request, response); return; doInit(filterConfig); processResolvedSiteMapItem(req, res, requestContext, processSiteMapItemHandlers, logger);
resolvedSiteMapItem = processHandlers(resolvedSiteMapItem, req, res); if(resolvedSiteMapItem == null) { requestContext.setBaseURL(virtualHostsManager.getUrlFactory().getContainerURLProvider().createURL(requestContext.getBaseURL(), forwardPathInfo)); processResolvedSiteMapItem(req, res, requestContext, true, logger);
log("Invalid client component manager class or configuration: " + e);
componentManager = HstFilter.getClientComponentManager(getServletContext());