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.springframework.context.support.StaticApplicationContext
                  extended by org.codehaus.groovy.grails.commons.spring.GrailsApplicationContext
                      extended by org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext
All Implemented Interfaces:
groovy.lang.GroovyObject, org.springframework.beans.factory.BeanFactory, org.springframework.beans.factory.DisposableBean, 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.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 GrailsApplicationContext
implements org.springframework.web.context.ConfigurableWebApplicationContext, groovy.lang.GroovyObject, org.springframework.ui.context.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, logger, MESSAGE_SOURCE_BEAN_NAME
 
Fields inherited from interface org.springframework.web.context.WebApplicationContext
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_GLOBAL_SESSION, SCOPE_REQUEST, SCOPE_SESSION
 
Fields inherited from interface org.springframework.context.ConfigurableApplicationContext
CONFIG_LOCATION_DELIMITERS, LOAD_TIME_WEAVER_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(org.springframework.context.ApplicationContext parent)
           
 
Method Summary
 java.lang.ClassLoader getClassLoader()
           
 java.lang.String[] getConfigLocations()
           
 java.lang.String getNamespace()
           
protected  org.springframework.core.io.Resource getResourceByPath(java.lang.String path)
          This implementation supports file paths beneath the root of the ServletContext.
protected  org.springframework.core.io.support.ResourcePatternResolver getResourcePatternResolver()
          This implementation supports pattern matching in unexpanded WARs too.
 javax.servlet.ServletConfig getServletConfig()
           
 javax.servlet.ServletContext getServletContext()
           
protected  void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
          Register ServletContextAwareProcessor.
 void refresh()
           
 void setConfigLocation(java.lang.String s)
           
 void setConfigLocations(java.lang.String[] configLocations)
           
 void setNamespace(java.lang.String namespace)
           
 void setServletConfig(javax.servlet.ServletConfig servletConfig)
           
 void setServletContext(javax.servlet.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, setMetaClass, setProperty
 
Methods inherited from class org.springframework.context.support.StaticApplicationContext
addMessage, getStaticMessageSource, registerPrototype, registerPrototype, registerSingleton, registerSingleton
 
Methods inherited from class org.springframework.context.support.GenericApplicationContext
closeBeanFactory, getBeanDefinition, getBeanFactory, getDefaultListableBeanFactory, getResource, getResources, isAlias, isBeanNameInUse, refreshBeanFactory, registerAlias, registerBeanDefinition, removeAlias, removeBeanDefinition, setParent, setResourceLoader
 
Methods inherited from class org.springframework.context.support.AbstractApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, addListener, cancelRefresh, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, doClose, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getDisplayName, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getStartupDate, getType, initApplicationEventMulticaster, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, obtainFreshBeanFactory, onClose, prepareBeanFactory, prepareRefresh, publishEvent, registerBeanPostProcessors, registerListeners, registerShutdownHook, setDisplayName, setId, 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, setParent
 
Methods inherited from interface org.springframework.context.ApplicationContext
getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
 
Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType
 
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, 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 org.springframework.beans.BeansException
Throws:
org.springframework.beans.BeansException

GrailsWebApplicationContext

public GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent)
                            throws org.springframework.beans.BeansException
Throws:
org.springframework.beans.BeansException
Method Detail

getClassLoader

public java.lang.ClassLoader getClassLoader()
Specified by:
getClassLoader in interface org.springframework.core.io.ResourceLoader
Overrides:
getClassLoader in class org.springframework.core.io.DefaultResourceLoader

setServletContext

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

Specified by:
setServletContext in interface org.springframework.web.context.ConfigurableWebApplicationContext

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in interface org.springframework.web.context.WebApplicationContext

setNamespace

public void setNamespace(java.lang.String namespace)
Specified by:
setNamespace in interface org.springframework.web.context.ConfigurableWebApplicationContext

getNamespace

public java.lang.String getNamespace()
Specified by:
getNamespace in interface org.springframework.web.context.ConfigurableWebApplicationContext

setConfigLocation

public void setConfigLocation(java.lang.String s)
Specified by:
setConfigLocation in interface org.springframework.web.context.ConfigurableWebApplicationContext

setConfigLocations

public void setConfigLocations(java.lang.String[] configLocations)
Specified by:
setConfigLocations in interface org.springframework.web.context.ConfigurableWebApplicationContext

getConfigLocations

public java.lang.String[] getConfigLocations()
Specified by:
getConfigLocations in interface org.springframework.web.context.ConfigurableWebApplicationContext

postProcessBeanFactory

protected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
Register ServletContextAwareProcessor.

Overrides:
postProcessBeanFactory in class org.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:
getResourceByPath in class org.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:
getResourcePatternResolver in class org.springframework.context.support.AbstractApplicationContext
See Also:
ServletContextResourcePatternResolver

refresh

public void refresh()
             throws org.springframework.beans.BeansException,
                    java.lang.IllegalStateException
Specified by:
refresh in interface org.springframework.context.ConfigurableApplicationContext
Overrides:
refresh in class org.springframework.context.support.AbstractApplicationContext
Throws:
org.springframework.beans.BeansException
java.lang.IllegalStateException

setServletConfig

public void setServletConfig(javax.servlet.ServletConfig servletConfig)
Specified by:
setServletConfig in interface org.springframework.web.context.ConfigurableWebApplicationContext

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Specified by:
getServletConfig in interface org.springframework.web.context.ConfigurableWebApplicationContext


Copyright (c) 2005-2006 The Grails project