Package de.hybris.platform.spring
Class HybrisContextLoaderListener
java.lang.Object
org.springframework.web.context.ContextLoader
org.springframework.web.context.ContextLoaderListener
de.hybris.platform.spring.HybrisContextLoaderListener
- All Implemented Interfaces:
EventListener,javax.servlet.ServletContextListener
- Direct Known Subclasses:
BackofficeApplicationContextInitializer,HybrisStorefrontContextLoaderListener,ServletContextStartupWatcherTest.HybrisContextLoaderListenerMock,TenantUnawareHybrisContextLoaderListener
public class HybrisContextLoaderListener
extends org.springframework.web.context.ContextLoaderListener
Sets the global application context as parent context for created WebApplicationContext. and registers a
HttpSessionListener for
Supports loading additional web spring config files. The additional config files are specified in a hybris configuration property. The property name is built as follows: <display-name>.additionalWebSpringConfigs Where <display-name> is ServletContext.getServletContextName() which is actually the <display-name> element from the web.xml for the web application.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringstatic final Stringstatic final StringFields inherited from class org.springframework.web.context.ContextLoader
CONFIG_LOCATION_PARAM, CONTEXT_CLASS_PARAM, CONTEXT_ID_PARAM, CONTEXT_INITIALIZER_CLASSES_PARAM, GLOBAL_INITIALIZER_CLASSES_PARAM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCustomConfigLocations(org.springframework.web.context.ConfigurableWebApplicationContext applicationContext, List<String> customConfLocations) protected voidadjustTenant(javax.servlet.ServletContext servletContext) protected voidattachTenantIDToServletContext(javax.servlet.ServletContext ctx, String tenantID) voidcontextInitialized(javax.servlet.ServletContextEvent event) protected voidcontextInitializedInternal(javax.servlet.ServletContextEvent event) protected org.springframework.web.context.WebApplicationContextcreateWebApplicationContext(javax.servlet.ServletContext servletContext) protected voidcustomizeContext(javax.servlet.ServletContext servletContext, org.springframework.web.context.ConfigurableWebApplicationContext applicationContext) protected org.springframework.web.context.WebApplicationContextdoInitWebApplicationContext(javax.servlet.ServletContext servletContext) protected voidfillConfigLocations(String appName, List<String> locations) protected voidfillConfigLocationsFromExtension(String appName, String fromExtension, List<String> locations) protected voidfillConfigLocationsFromExtensions(String appName, List<String> locations) protected voidfillConfigLocationsFromParameter(String parameterKey, List<String> locations) protected voidfillLegacyConfigLocations(String appName, List<String> locations) protected StringgetTenanId(String contextPath) static StringgetTenantIDForWebapp(javax.servlet.ServletContext ctx) org.springframework.web.context.WebApplicationContextinitWebApplicationContext(javax.servlet.ServletContext servletContext) Overridden just for handling not found tenants.protected org.springframework.context.ApplicationContextloadParentContext(javax.servlet.ServletContext servletContext) protected StringreadConfigParameter(String parameterKey) protected voidregisterHttpSessionListener(javax.servlet.ServletContext servletContext) protected voidrunWithActiveJaloSession(String tenantId, javax.servlet.http.HttpSession httpSession, Runnable runnable) protected voidrunWithTenant(String tenantId, Runnable runnable) protected voidMethods inherited from class org.springframework.web.context.ContextLoaderListener
contextDestroyedMethods inherited from class org.springframework.web.context.ContextLoader
closeWebApplicationContext, configureAndRefreshWebApplicationContext, determineContextClass, determineContextInitializerClasses, getCurrentWebApplicationContext, setContextInitializers
-
Field Details
-
ADDITIONAL_WEB_SPRING_CONFIGS
- See Also:
-
ADDITIONAL_WEB_SPRING_CONFIGS_FROM_EXT
- See Also:
-
CORE_SPRING_DEVELOPMENT_MODE_FLAG_KEY
- See Also:
-
WEB_SPRING_DEVELOPMENT_MODE_FLAG_KEY
- See Also:
-
-
Constructor Details
-
HybrisContextLoaderListener
public HybrisContextLoaderListener()
-
-
Method Details
-
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent event) - Specified by:
contextInitializedin interfacejavax.servlet.ServletContextListener- Overrides:
contextInitializedin classorg.springframework.web.context.ContextLoaderListener
-
contextInitializedInternal
protected void contextInitializedInternal(javax.servlet.ServletContextEvent event) -
registerHttpSessionListener
protected void registerHttpSessionListener(javax.servlet.ServletContext servletContext) -
runWithTenant
-
runWithActiveJaloSession
-
initWebApplicationContext
public org.springframework.web.context.WebApplicationContext initWebApplicationContext(javax.servlet.ServletContext servletContext) Overridden just for handling not found tenants. It wraps around theloadParentContext(ServletContext).- Overrides:
initWebApplicationContextin classorg.springframework.web.context.ContextLoader
-
doInitWebApplicationContext
protected org.springframework.web.context.WebApplicationContext doInitWebApplicationContext(javax.servlet.ServletContext servletContext) -
loadParentContext
protected org.springframework.context.ApplicationContext loadParentContext(javax.servlet.ServletContext servletContext) throws org.springframework.beans.BeansException - Overrides:
loadParentContextin classorg.springframework.web.context.ContextLoader- Throws:
org.springframework.beans.BeansException
-
customizeContext
protected void customizeContext(javax.servlet.ServletContext servletContext, org.springframework.web.context.ConfigurableWebApplicationContext applicationContext) - Overrides:
customizeContextin classorg.springframework.web.context.ContextLoader
-
adjustTenant
protected void adjustTenant(javax.servlet.ServletContext servletContext) throws TenantNotFoundException - Throws:
TenantNotFoundException
-
getTenantIDForWebapp
-
attachTenantIDToServletContext
-
startRegistry
protected void startRegistry() -
createWebApplicationContext
protected org.springframework.web.context.WebApplicationContext createWebApplicationContext(javax.servlet.ServletContext servletContext) - Overrides:
createWebApplicationContextin classorg.springframework.web.context.ContextLoader
-
getTenanId
-
fillConfigLocations
-
fillLegacyConfigLocations
-
fillConfigLocationsFromExtensions
-
fillConfigLocationsFromExtension
-
fillConfigLocationsFromParameter
-
addCustomConfigLocations
-
readConfigParameter
-