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 Details

  • Constructor Details

    • HybrisContextLoaderListener

      public HybrisContextLoaderListener()
  • Method Details

    • contextInitialized

      public void contextInitialized(javax.servlet.ServletContextEvent event)
      Specified by:
      contextInitialized in interface javax.servlet.ServletContextListener
      Overrides:
      contextInitialized in class org.springframework.web.context.ContextLoaderListener
    • contextInitializedInternal

      protected void contextInitializedInternal(javax.servlet.ServletContextEvent event)
    • registerHttpSessionListener

      protected void registerHttpSessionListener(javax.servlet.ServletContext servletContext)
    • runWithTenant

      protected void runWithTenant(String tenantId, Runnable runnable)
    • runWithActiveJaloSession

      protected void runWithActiveJaloSession(String tenantId, javax.servlet.http.HttpSession httpSession, Runnable runnable)
    • initWebApplicationContext

      public org.springframework.web.context.WebApplicationContext initWebApplicationContext(javax.servlet.ServletContext servletContext)
      Overridden just for handling not found tenants. It wraps around the loadParentContext(ServletContext).
      Overrides:
      initWebApplicationContext in class org.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:
      loadParentContext in class org.springframework.web.context.ContextLoader
      Throws:
      org.springframework.beans.BeansException
    • customizeContext

      protected void customizeContext(javax.servlet.ServletContext servletContext, org.springframework.web.context.ConfigurableWebApplicationContext applicationContext)
      Overrides:
      customizeContext in class org.springframework.web.context.ContextLoader
    • adjustTenant

      protected void adjustTenant(javax.servlet.ServletContext servletContext) throws TenantNotFoundException
      Throws:
      TenantNotFoundException
    • getTenantIDForWebapp

      public static String getTenantIDForWebapp(javax.servlet.ServletContext ctx)
    • attachTenantIDToServletContext

      protected void attachTenantIDToServletContext(javax.servlet.ServletContext ctx, String tenantID)
    • startRegistry

      protected void startRegistry()
    • createWebApplicationContext

      protected org.springframework.web.context.WebApplicationContext createWebApplicationContext(javax.servlet.ServletContext servletContext)
      Overrides:
      createWebApplicationContext in class org.springframework.web.context.ContextLoader
    • getTenanId

      protected String getTenanId(String contextPath)
    • fillConfigLocations

      protected void fillConfigLocations(String appName, List<String> locations)
    • fillLegacyConfigLocations

      protected void fillLegacyConfigLocations(String appName, List<String> locations)
    • fillConfigLocationsFromExtensions

      protected void fillConfigLocationsFromExtensions(String appName, List<String> locations)
    • fillConfigLocationsFromExtension

      protected void fillConfigLocationsFromExtension(String appName, String fromExtension, List<String> locations)
    • fillConfigLocationsFromParameter

      protected void fillConfigLocationsFromParameter(String parameterKey, List<String> locations)
    • addCustomConfigLocations

      protected void addCustomConfigLocations(org.springframework.web.context.ConfigurableWebApplicationContext applicationContext, List<String> customConfLocations)
    • readConfigParameter

      protected String readConfigParameter(String parameterKey)