|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.springframework.core.io.DefaultResourceLoader
org.springframework.context.support.AbstractApplicationContext
org.springframework.context.support.AbstractRefreshableApplicationContext
org.springframework.web.context.support.AbstractRefreshableWebApplicationContext
AbstractRefreshableApplicationContext subclass that implements the ConfigurableWebApplicationContext interface for web environments. Pre-implements a "configLocation" property, to be populated through the ConfigurableWebApplicationContext interface on web application startup.
This class is as easy to subclass as AbstractRefreshableApplicationContext:
All you need to implements is the loadBeanDefinitions method;
see the superclass javadoc for details. Note that implementations are supposed
to load bean definitions from the files specified by the locations returned
by the getConfigLocations method.
Interprets resource paths as servlet context resources, i.e. as paths beneath the web application root. Absolute paths, e.g. for files outside the web app root, can be accessed via "file:" URLs, as implemented by AbstractApplicationContext.
In addition to the special beans detected by AbstractApplicationContext, this class detects a ThemeSource bean in the context, with the name "themeSource".
This is the web context to be subclassed for a different bean definition format. Such a context implementation can be specified as "contextClass" context-param for ContextLoader or "contextClass" init-param for FrameworkServlet, replacing the default XmlWebApplicationContext. It would automatically receive the "contextConfigLocation" context-param or init-param, respectively.
Note that WebApplicationContext implementations are generally supposed to configure themselves based on the configuration received through the ConfigurableWebApplicationContext interface. In contrast, a standalone application context might allow for configuration in custom startup code (for example, GenericApplicationContext).
ConfigurableWebApplicationContext.setConfigLocations(java.lang.String[]),
getConfigLocations(),
AbstractRefreshableApplicationContext.loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory),
ServletContextResourcePatternResolver,
AbstractApplicationContext,
ThemeSource,
XmlWebApplicationContext,
GenericApplicationContext| Field Summary |
| Fields inherited from class org.springframework.context.support.AbstractApplicationContext |
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME |
| Fields inherited from interface org.springframework.web.context.ConfigurableWebApplicationContext |
CONFIG_LOCATION_DELIMITERS |
| Fields inherited from interface org.springframework.web.context.WebApplicationContext |
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE |
| Fields inherited from interface org.springframework.beans.factory.BeanFactory |
FACTORY_BEAN_PREFIX |
| Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver |
CLASSPATH_URL_PREFIX |
| Constructor Summary | |
AbstractRefreshableWebApplicationContext()
|
|
| Method Summary | |
protected String[] |
getConfigLocations()
|
protected String[] |
getDefaultConfigLocations()
Return the default config locations to use, for the case where no explicit config locations have been specified. |
protected String |
getNamespace()
|
protected Resource |
getResourceByPath(String path)
Resolve file paths beneath the root of the web application. |
protected ResourcePatternResolver |
getResourcePatternResolver()
Use a ServletContextResourcePatternResolver, to be able to find matching resources below the web application root directory even in a WAR file which has not been expanded. |
ServletContext |
getServletContext()
Return the standard Servlet API ServletContext for this application. |
Theme |
getTheme(String themeName)
Return the Theme instance for the given theme name. |
protected void |
onRefresh()
Initialize the theme capability. |
protected void |
postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
Register ServletContextAwareProcessor. |
void |
refresh()
Sets a default config location if no explicit config location specified. |
void |
setConfigLocations(String[] configLocations)
Set the config locations for this web application context. |
void |
setNamespace(String namespace)
Set the namespace for this web application context, to be used for building a default context config location. |
void |
setServletContext(ServletContext servletContext)
Set the ServletContext for this web application context. |
String |
toString()
Return diagnostic information. |
| Methods inherited from class org.springframework.context.support.AbstractRefreshableApplicationContext |
createBeanFactory, getBeanFactory, loadBeanDefinitions, refreshBeanFactory |
| Methods inherited from class org.springframework.context.support.AbstractApplicationContext |
addBeanFactoryPostProcessor, addListener, close, containsBean, containsBeanDefinition, getAliases, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeansOfType, getBeansOfType, getDisplayName, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResources, getStartupDate, getType, isSingleton, publishEvent, setDisplayName, setParent |
| Methods inherited from class org.springframework.core.io.DefaultResourceLoader |
getClassLoader, getResource |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.springframework.context.ApplicationContext |
getDisplayName, getParent, getStartupDate, publishEvent |
| Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory |
containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeansOfType, getBeansOfType |
| Methods inherited from interface org.springframework.beans.factory.BeanFactory |
containsBean, getAliases, getBean, getBean, getType, isSingleton |
| Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory |
getParentBeanFactory |
| Methods inherited from interface org.springframework.context.MessageSource |
getMessage, getMessage, getMessage |
| Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver |
getResources |
| Methods inherited from interface org.springframework.core.io.ResourceLoader |
getResource |
| Methods inherited from interface org.springframework.context.ConfigurableApplicationContext |
addBeanFactoryPostProcessor, close, getBeanFactory, setParent |
| Constructor Detail |
public AbstractRefreshableWebApplicationContext()
| Method Detail |
public void setServletContext(ServletContext servletContext)
ConfigurableWebApplicationContextDoes not cause an initialization of the context: refresh needs to be called after the setting of all configuration properties.
setServletContext in interface ConfigurableWebApplicationContextConfigurableApplicationContext.refresh()public ServletContext getServletContext()
WebApplicationContext
getServletContext in interface WebApplicationContextpublic void setNamespace(String namespace)
ConfigurableWebApplicationContext
setNamespace in interface ConfigurableWebApplicationContextprotected String getNamespace()
public void setConfigLocations(String[] configLocations)
ConfigurableWebApplicationContext
setConfigLocations in interface ConfigurableWebApplicationContextprotected String[] getConfigLocations()
public void refresh()
throws BeansException
refresh in interface ConfigurableApplicationContextrefresh in class AbstractApplicationContextBeansExceptiongetDefaultConfigLocations(),
setConfigLocations(java.lang.String[])protected String[] getDefaultConfigLocations()
Default implementation returns null, requiring explicit config locations.
setConfigLocations(java.lang.String[])protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
postProcessBeanFactory in class AbstractApplicationContextbeanFactory - the bean factory used by the application contextServletContextAwareProcessorprotected Resource getResourceByPath(String path)
Note: Even if a given path starts with a slash, it will get interpreted as relative to the web application root directory (which is the way most servlet containers handle such paths).
getResourceByPath in class DefaultResourceLoaderpath - path to the resource
ServletContextResourceprotected ResourcePatternResolver getResourcePatternResolver()
getResourcePatternResolver in class AbstractApplicationContextServletContextResourcePatternResolverprotected void onRefresh()
onRefresh in class AbstractApplicationContextAbstractApplicationContext.refresh()public Theme getTheme(String themeName)
ThemeSource
getTheme in interface ThemeSourcethemeName - name of the theme
public String toString()
toString in class AbstractApplicationContext
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||