@Singleton public class MagnoliaServletContextListener extends Object implements javax.servlet.ServletContextListener
ConfigLoader
for completing initialization.
When Magnolia starts up the first thing that happens is the creation of the platform component provider. It
contains the essential singletons that constitutes the platform on which the rest of the system builds. These
components are defined in a file called platform-components.xml
, it's on the classpath in package
/info/magnolia/init.
The location can be customized using a servlet context parameter called
magnolia.platform.components.config.location
. It's specified as a list of comma-separated files on the
classpath. The files are loaded in the specified order allowing definitions to override definitions from earlier
files.
<context-param> <param-name>magnolia.platform.components.config.location</param-name> <param-value>/info/magnolia/init/platform-components.xml,/com/mycompany/custom-platform-components.xml</param-value> </context-param>
The platform components include the ModuleManager
which is called by this listener to load the descriptors of
all the modules present. Modules define additional components that are loaded into a second component provider called
system.
When ConfigLoader
takes over the initialization procedure it will create a third component provider called
main which contain components defined in modules as belonging to the main component provider.
Properties are loaded by an implementation of MagnoliaConfigurationProperties
. It's configured as a platform
component and is called by this class to do initialization. See DefaultMagnoliaPropertiesResolver
and
DefaultMagnoliaInitPaths
for details on how to customize the default behavior.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_PLATFORM_COMPONENTS_CONFIG_LOCATION |
static String |
PLATFORM_COMPONENTS_CONFIG_LOCATION_NAME |
Constructor and Description |
---|
MagnoliaServletContextListener() |
Modifier and Type | Method and Description |
---|---|
void |
contextDestroyed(javax.servlet.ServletContextEvent sce) |
void |
contextInitialized(javax.servlet.ServletContextEvent sce) |
void |
contextInitialized(javax.servlet.ServletContextEvent sce,
boolean startServer) |
protected ComponentProviderConfiguration |
getPlatformComponents() |
protected List<String> |
getPlatformComponentsResources()
Returns a list of resources that contain platform components.
|
protected ComponentProviderConfiguration |
getSystemComponents() |
protected String |
initRootPath(javax.servlet.ServletContext context)
Deprecated.
since 4.5, use or subclass
MagnoliaInitPaths . |
protected String |
initServername(boolean unqualified)
Deprecated.
since 4.5, use or subclass
MagnoliaInitPaths . |
protected String |
initWebappName(String rootPath)
Deprecated.
since 4.5, use or subclass
MagnoliaInitPaths . |
protected void |
startServer() |
protected void |
stopServer() |
public static final String PLATFORM_COMPONENTS_CONFIG_LOCATION_NAME
public static final String DEFAULT_PLATFORM_COMPONENTS_CONFIG_LOCATION
public void contextInitialized(javax.servlet.ServletContextEvent sce)
contextInitialized
in interface javax.servlet.ServletContextListener
public void contextInitialized(javax.servlet.ServletContextEvent sce, boolean startServer)
public void contextDestroyed(javax.servlet.ServletContextEvent sce)
contextDestroyed
in interface javax.servlet.ServletContextListener
protected ComponentProviderConfiguration getPlatformComponents()
protected List<String> getPlatformComponentsResources()
protected ComponentProviderConfiguration getSystemComponents()
protected void startServer()
protected void stopServer()
@Deprecated protected String initWebappName(String rootPath)
MagnoliaInitPaths
.@Deprecated protected String initRootPath(javax.servlet.ServletContext context)
MagnoliaInitPaths
.@Deprecated protected String initServername(boolean unqualified)
MagnoliaInitPaths
.Copyright © 2003–2020 Magnolia International Ltd.. All rights reserved.