Package grails.web.servlet.context
Class GrailsWebApplicationContext
- java.lang.Object
-
- org.springframework.core.io.DefaultResourceLoader
-
- org.springframework.context.support.AbstractApplicationContext
-
- org.springframework.context.support.GenericApplicationContext
-
- org.grails.spring.GrailsApplicationContext
-
- grails.web.servlet.context.GrailsWebApplicationContext
-
- All Implemented Interfaces:
groovy.lang.GroovyObject,java.io.Closeable,java.lang.AutoCloseable,org.springframework.beans.factory.BeanFactory,org.springframework.beans.factory.HierarchicalBeanFactory,org.springframework.beans.factory.ListableBeanFactory,org.springframework.beans.factory.support.BeanDefinitionRegistry,org.springframework.context.ApplicationContext,org.springframework.context.ApplicationEventPublisher,org.springframework.context.ConfigurableApplicationContext,org.springframework.context.Lifecycle,org.springframework.context.MessageSource,org.springframework.core.AliasRegistry,org.springframework.core.env.EnvironmentCapable,org.springframework.core.io.ResourceLoader,org.springframework.core.io.support.ResourcePatternResolver,org.springframework.ui.context.ThemeSource,org.springframework.web.context.ConfigurableWebApplicationContext,org.springframework.web.context.WebApplicationContext
public class GrailsWebApplicationContext extends org.grails.spring.GrailsApplicationContext implements org.springframework.web.context.ConfigurableWebApplicationContext, org.springframework.ui.context.ThemeSourceA WebApplicationContext that extends StaticApplicationContext to allow for programmatic configuration at runtime. The code is adapted from StaticWebApplicationContext.- Since:
- 0.3
-
-
Field Summary
-
Fields inherited from class org.springframework.context.support.AbstractApplicationContext
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME
-
Fields inherited from interface org.springframework.context.ConfigurableApplicationContext
APPLICATION_STARTUP_BEAN_NAME, CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME
-
Fields inherited from interface org.springframework.web.context.ConfigurableWebApplicationContext
APPLICATION_CONTEXT_ID_PREFIX, SERVLET_CONFIG_BEAN_NAME
-
-
Constructor Summary
Constructors Constructor Description GrailsWebApplicationContext()GrailsWebApplicationContext(grails.core.GrailsApplication grailsApplication)GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory)GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, grails.core.GrailsApplication grailsApplication)GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, org.springframework.context.ApplicationContext parent)GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, org.springframework.context.ApplicationContext parent, grails.core.GrailsApplication grailsApplication)GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent)GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent, grails.core.GrailsApplication grailsApplication)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.core.env.ConfigurableEnvironmentcreateEnvironment()java.lang.ClassLoadergetClassLoader()java.lang.String[]getConfigLocations()org.springframework.web.context.ConfigurableWebEnvironmentgetEnvironment()java.lang.StringgetNamespace()protected org.springframework.core.io.ResourcegetResourceByPath(java.lang.String path)This implementation supports file paths beneath the root of the ServletContext.protected org.springframework.core.io.support.ResourcePatternResolvergetResourcePatternResolver()This implementation supports pattern matching in unexpanded WARs too.javax.servlet.ServletConfiggetServletConfig()javax.servlet.ServletContextgetServletContext()protected voidpostProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)Register ServletContextAwareProcessor.protected voidprepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)voidsetConfigLocation(java.lang.String configLocation)voidsetConfigLocations(java.lang.String[] configLocations)voidsetNamespace(java.lang.String namespace)voidsetServletConfig(javax.servlet.ServletConfig servletConfig)voidsetServletContext(javax.servlet.ServletContext servletContext)Set the ServletContext that this WebApplicationContext runs in.-
Methods inherited from class org.grails.spring.GrailsApplicationContext
assertBeanFactoryActive, containsBeanDefinition, getMetaClass, getProperty, getTheme, invokeMethod, onRefresh, registerPrototype, registerPrototype, registerSingleton, registerSingleton, setMetaClass, setProperty
-
Methods inherited from class org.springframework.context.support.GenericApplicationContext
cancelRefresh, closeBeanFactory, getAutowireCapableBeanFactory, getBeanDefinition, getBeanFactory, getDefaultListableBeanFactory, getResource, getResources, isAlias, isBeanNameInUse, refreshBeanFactory, registerAlias, registerBean, registerBean, registerBean, registerBean, registerBean, registerBean, registerBeanDefinition, removeAlias, removeBeanDefinition, setAllowBeanDefinitionOverriding, setAllowCircularReferences, setApplicationStartup, setClassLoader, setParent, setResourceLoader
-
Methods inherited from class org.springframework.context.support.AbstractApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, close, containsBean, containsLocalBean, destroy, destroyBeans, doClose, findAnnotationOnBean, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getApplicationName, getApplicationStartup, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getStartupDate, getType, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, initPropertySources, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, prepareRefresh, publishEvent, publishEvent, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, resetCommonCaches, setDisplayName, setEnvironment, setId, start, stop, toString
-
Methods inherited from class org.springframework.core.io.DefaultResourceLoader
addProtocolResolver, clearResourceCaches, getProtocolResolvers, getResourceCache
-
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
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
-
Methods inherited from interface org.springframework.context.ApplicationEventPublisher
publishEvent, publishEvent
-
Methods inherited from interface org.springframework.beans.factory.support.BeanDefinitionRegistry
getBeanDefinitionCount, getBeanDefinitionNames
-
Methods inherited from interface org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch
-
Methods inherited from interface org.springframework.context.ConfigurableApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getApplicationStartup, getBeanFactory, isActive, refresh, registerShutdownHook, setApplicationStartup, setClassLoader, setEnvironment, setId, setParent
-
Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory
-
Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation
-
Methods inherited from interface org.springframework.context.MessageSource
getMessage, getMessage, getMessage
-
-
-
-
Constructor Detail
-
GrailsWebApplicationContext
public GrailsWebApplicationContext() throws org.springframework.beans.BeansException- Throws:
org.springframework.beans.BeansException
-
GrailsWebApplicationContext
public GrailsWebApplicationContext(grails.core.GrailsApplication grailsApplication)
-
GrailsWebApplicationContext
public GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent) throws org.springframework.beans.BeansException- Throws:
org.springframework.beans.BeansException
-
GrailsWebApplicationContext
public GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, grails.core.GrailsApplication grailsApplication)
-
GrailsWebApplicationContext
public GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent, grails.core.GrailsApplication grailsApplication) throws org.springframework.beans.BeansException- Throws:
org.springframework.beans.BeansException
-
GrailsWebApplicationContext
public GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory)
-
GrailsWebApplicationContext
public GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, org.springframework.context.ApplicationContext parent)
-
GrailsWebApplicationContext
public GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, org.springframework.context.ApplicationContext parent, grails.core.GrailsApplication grailsApplication)
-
-
Method Detail
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
- Specified by:
getClassLoaderin interfaceorg.springframework.core.io.ResourceLoader- Overrides:
getClassLoaderin classorg.springframework.context.support.GenericApplicationContext
-
setServletContext
public void setServletContext(javax.servlet.ServletContext servletContext)
Set the ServletContext that this WebApplicationContext runs in.- Specified by:
setServletContextin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
getServletContext
public javax.servlet.ServletContext getServletContext()
- Specified by:
getServletContextin interfaceorg.springframework.web.context.WebApplicationContext
-
setNamespace
public void setNamespace(java.lang.String namespace)
- Specified by:
setNamespacein interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
getNamespace
public java.lang.String getNamespace()
- Specified by:
getNamespacein interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
setConfigLocation
public void setConfigLocation(java.lang.String configLocation)
- Specified by:
setConfigLocationin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
setConfigLocations
public void setConfigLocations(java.lang.String[] configLocations)
- Specified by:
setConfigLocationsin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
getConfigLocations
public java.lang.String[] getConfigLocations()
- Specified by:
getConfigLocationsin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
postProcessBeanFactory
protected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
Register ServletContextAwareProcessor.- Overrides:
postProcessBeanFactoryin classorg.springframework.context.support.AbstractApplicationContext- See Also:
ServletContextAwareProcessor
-
getResourceByPath
protected org.springframework.core.io.Resource getResourceByPath(java.lang.String path)
This implementation supports file paths beneath the root of the ServletContext.- Overrides:
getResourceByPathin classorg.springframework.core.io.DefaultResourceLoader- See Also:
ServletContextResource
-
getResourcePatternResolver
protected org.springframework.core.io.support.ResourcePatternResolver getResourcePatternResolver()
This implementation supports pattern matching in unexpanded WARs too.- Overrides:
getResourcePatternResolverin classorg.springframework.context.support.AbstractApplicationContext- See Also:
ServletContextResourcePatternResolver
-
prepareBeanFactory
protected void prepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
- Overrides:
prepareBeanFactoryin classorg.grails.spring.GrailsApplicationContext
-
setServletConfig
public void setServletConfig(javax.servlet.ServletConfig servletConfig)
- Specified by:
setServletConfigin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
getServletConfig
public javax.servlet.ServletConfig getServletConfig()
- Specified by:
getServletConfigin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
createEnvironment
protected org.springframework.core.env.ConfigurableEnvironment createEnvironment()
- Overrides:
createEnvironmentin classorg.springframework.context.support.AbstractApplicationContext
-
getEnvironment
public org.springframework.web.context.ConfigurableWebEnvironment getEnvironment()
- Specified by:
getEnvironmentin interfaceorg.springframework.context.ConfigurableApplicationContext- Specified by:
getEnvironmentin interfaceorg.springframework.core.env.EnvironmentCapable- Overrides:
getEnvironmentin classorg.springframework.context.support.AbstractApplicationContext
-
-