org.codehaus.groovy.grails.commons.spring
Class GrailsWebApplicationContext

java.lang.Object
  extended by org.springframework.core.io.DefaultResourceLoader
      extended by org.springframework.context.support.AbstractApplicationContext
          extended by org.springframework.context.support.GenericApplicationContext
              extended by org.codehaus.groovy.grails.commons.spring.GrailsApplicationContext
                  extended by org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext
All Implemented Interfaces:
groovy.lang.GroovyObject, BeanFactory, DisposableBean, HierarchicalBeanFactory, ListableBeanFactory, BeanDefinitionRegistry, ApplicationContext, ApplicationEventPublisher, ConfigurableApplicationContext, Lifecycle, MessageSource, AliasRegistry, ResourceLoader, ResourcePatternResolver, ThemeSource, ConfigurableWebApplicationContext, WebApplicationContext

public class GrailsWebApplicationContext
extends GrailsApplicationContext
implements ConfigurableWebApplicationContext, groovy.lang.GroovyObject, ThemeSource

A WebApplicationContext that extends StaticApplicationContext to allow for programmatic configuration at runtime. The code is adapted from StaticWebApplicationContext.

Since:
0.3
Author:
Graeme

Field Summary
 
Fields inherited from class org.codehaus.groovy.grails.commons.spring.GrailsApplicationContext
metaClass
 
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.web.context.ConfigurableWebApplicationContext
APPLICATION_CONTEXT_ID_PREFIX, SERVLET_CONFIG_BEAN_NAME
 
Fields inherited from interface org.springframework.web.context.WebApplicationContext
CONTEXT_ATTRIBUTES_BEAN_NAME, CONTEXT_PARAMETERS_BEAN_NAME, ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_APPLICATION, SCOPE_GLOBAL_SESSION, SCOPE_REQUEST, SCOPE_SESSION, SERVLET_CONTEXT_BEAN_NAME
 
Fields inherited from interface org.springframework.context.ConfigurableApplicationContext
CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME
 
Fields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX
 
Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX
 
Fields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
 
Constructor Summary
GrailsWebApplicationContext()
           
GrailsWebApplicationContext(ApplicationContext parent)
           
GrailsWebApplicationContext(DefaultListableBeanFactory defaultListableBeanFactory)
           
GrailsWebApplicationContext(DefaultListableBeanFactory defaultListableBeanFactory, ApplicationContext parent)
           
 
Method Summary
 ClassLoader getClassLoader()
           
 String[] getConfigLocations()
           
 String getNamespace()
           
protected  Resource getResourceByPath(String path)
          This implementation supports file paths beneath the root of the ServletContext.
protected  ResourcePatternResolver getResourcePatternResolver()
          This implementation supports pattern matching in unexpanded WARs too.
 ServletConfig getServletConfig()
           
 ServletContext getServletContext()
           
protected  void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
          Register ServletContextAwareProcessor.
protected  void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory)
           
 void refresh()
           
 void setConfigLocation(String configLocation)
           
 void setConfigLocations(String[] configLocations)
           
 void setNamespace(String namespace)
           
 void setServletConfig(ServletConfig servletConfig)
           
 void setServletContext(ServletContext servletContext)
          Set the ServletContext that this WebApplicationContext runs in.
 
Methods inherited from class org.codehaus.groovy.grails.commons.spring.GrailsApplicationContext
getMetaClass, getProperty, getTheme, invokeMethod, onRefresh, registerPrototype, registerPrototype, registerSingleton, registerSingleton, setMetaClass, setProperty
 
Methods inherited from class org.springframework.context.support.GenericApplicationContext
closeBeanFactory, getBeanDefinition, getBeanFactory, getDefaultListableBeanFactory, getResource, getResources, isAlias, isBeanNameInUse, refreshBeanFactory, registerAlias, registerBeanDefinition, removeAlias, removeBeanDefinition, setAllowBeanDefinitionOverriding, setAllowCircularReferences, setId, setParent, setResourceLoader
 
Methods inherited from class org.springframework.context.support.AbstractApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, addListener, cancelRefresh, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, doClose, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, obtainFreshBeanFactory, onClose, prepareRefresh, publishEvent, registerBeanPostProcessors, registerListeners, registerShutdownHook, setDisplayName, start, stop, toString
 
Methods inherited from class org.springframework.core.io.DefaultResourceLoader
setClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.context.ConfigurableApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, close, getBeanFactory, isActive, registerShutdownHook, setId, setParent
 
Methods inherited from interface org.springframework.context.ApplicationContext
getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
 
Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation
 
Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory
 
Methods inherited from interface org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch
 
Methods inherited from interface org.springframework.context.MessageSource
getMessage, getMessage, getMessage
 
Methods inherited from interface org.springframework.context.ApplicationEventPublisher
publishEvent
 
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.Lifecycle
isRunning, start, stop
 
Methods inherited from interface groovy.lang.GroovyObject
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty
 
Methods inherited from interface org.springframework.ui.context.ThemeSource
getTheme
 
Methods inherited from interface org.springframework.beans.factory.support.BeanDefinitionRegistry
containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames
 
Methods inherited from interface org.springframework.core.AliasRegistry
getAliases
 

Constructor Detail

GrailsWebApplicationContext

public GrailsWebApplicationContext()
                            throws BeansException
Throws:
BeansException

GrailsWebApplicationContext

public GrailsWebApplicationContext(ApplicationContext parent)
                            throws BeansException
Throws:
BeansException

GrailsWebApplicationContext

public GrailsWebApplicationContext(DefaultListableBeanFactory defaultListableBeanFactory)

GrailsWebApplicationContext

public GrailsWebApplicationContext(DefaultListableBeanFactory defaultListableBeanFactory,
                                   ApplicationContext parent)
Method Detail

getClassLoader

public ClassLoader getClassLoader()
Specified by:
getClassLoader in interface ResourceLoader
Overrides:
getClassLoader in class DefaultResourceLoader

setServletContext

public void setServletContext(ServletContext servletContext)
Set the ServletContext that this WebApplicationContext runs in.

Specified by:
setServletContext in interface ConfigurableWebApplicationContext

getServletContext

public ServletContext getServletContext()
Specified by:
getServletContext in interface WebApplicationContext

setNamespace

public void setNamespace(String namespace)
Specified by:
setNamespace in interface ConfigurableWebApplicationContext

getNamespace

public String getNamespace()
Specified by:
getNamespace in interface ConfigurableWebApplicationContext

setConfigLocation

public void setConfigLocation(String configLocation)
Specified by:
setConfigLocation in interface ConfigurableWebApplicationContext

setConfigLocations

public void setConfigLocations(String[] configLocations)
Specified by:
setConfigLocations in interface ConfigurableWebApplicationContext

getConfigLocations

public String[] getConfigLocations()
Specified by:
getConfigLocations in interface ConfigurableWebApplicationContext

postProcessBeanFactory

protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
Register ServletContextAwareProcessor.

Overrides:
postProcessBeanFactory in class AbstractApplicationContext
See Also:
ServletContextAwareProcessor

getResourceByPath

protected Resource getResourceByPath(String path)
This implementation supports file paths beneath the root of the ServletContext.

Overrides:
getResourceByPath in class DefaultResourceLoader
See Also:
ServletContextResource

getResourcePatternResolver

protected ResourcePatternResolver getResourcePatternResolver()
This implementation supports pattern matching in unexpanded WARs too.

Overrides:
getResourcePatternResolver in class AbstractApplicationContext
See Also:
ServletContextResourcePatternResolver

refresh

public void refresh()
             throws BeansException,
                    IllegalStateException
Specified by:
refresh in interface ConfigurableApplicationContext
Overrides:
refresh in class AbstractApplicationContext
Throws:
BeansException
IllegalStateException

prepareBeanFactory

protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory)
Overrides:
prepareBeanFactory in class AbstractApplicationContext

setServletConfig

public void setServletConfig(ServletConfig servletConfig)
Specified by:
setServletConfig in interface ConfigurableWebApplicationContext

getServletConfig

public ServletConfig getServletConfig()
Specified by:
getServletConfig in interface ConfigurableWebApplicationContext


Copyright (c) 2005-2009 The Grails project