The Spring Framework

## org.springframework.web.context
Interface WebApplicationContext

All Superinterfaces:
  ApplicationContext, ApplicationEventPublisher, BeanFactory, HierarchicalBeanFactory, ListableBeanFactory, MessageSource, ResourceLoader, ResourcePatternResolver

All Known Subinterfaces:
  ConfigurablePortletApplicationContext, ConfigurableWebApplicationContext

All Known Implementing Classes:
  AbstractRefreshablePortletApplicationContext, AbstractRefreshableWebApplicationContext, GenericWebApplicationContext, StaticPortletApplicationContext, StaticWebApplicationContext, XmlPortletApplicationContext, XmlWebApplicationContext

    public interface WebApplicationContext

extends ApplicationContext

Interface to provide configuration for a web application. This is read-only while the application is running, but may be reloaded if the implementation supports this.

This interface adds a getServletContext method to the generic ApplicationContext interface, and defines a well-known application attribute name that the root context must be bound to in the bootstrap process.

Like generic application contexts, web application contexts are hierarchical. There is a single root context per application, while each servlet in the application (including a dispatcher servlet in the MVC framework) has its own child context.

In addition to standard application context lifecycle capabilities, WebApplicationContext implementations need to detect ServletContextAware beans and invoke the setServletContext method accordingly.

Since:
  January 19, 2001
Author:
  Rod Johnson, Juergen Hoeller
See Also:
  `ServletContextAware.setServletContext(javax.servlet.ServletContext)`

Field Summary
`static String` `ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE` Context attribute to bind root WebApplicationContext to on successful startup.
`static String` `SCOPE_GLOBAL_SESSION` Scope identifier for global session scope: "globalSession".
`static String` `SCOPE_REQUEST` Scope identifier for request scope: "request".
`static String` `SCOPE_SESSION` Scope identifier for session scope: "session".

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`

Method Summary
`ServletContext` `getServletContext()` Return the standard Servlet API ServletContext for this application.

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
`getClassLoader, getResource`

Field Detail

### ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE

    static final String ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE

  Context attribute to bind root WebApplicationContext to on successful startup.

  Note: If the startup of the root context fails, this attribute can contain an exception or error as value. Use WebApplicationContextUtils for convenient lookup of the root WebApplicationContext.

  See Also:
    `WebApplicationContextUtils.getWebApplicationContext(javax.servlet.ServletContext)`, `WebApplicationContextUtils.getRequiredWebApplicationContext(javax.servlet.ServletContext)`

### SCOPE_REQUEST

    static final String SCOPE_REQUEST

  Scope identifier for request scope: "request". Supported in addition to the standard scopes "singleton" and "prototype".

  See Also:
    Constant Field Values

### SCOPE_SESSION

    static final String SCOPE_SESSION

  Scope identifier for session scope: "session". Supported in addition to the standard scopes "singleton" and "prototype".

  See Also:
    Constant Field Values

### SCOPE_GLOBAL_SESSION

    static final String SCOPE_GLOBAL_SESSION

  Scope identifier for global session scope: "globalSession". Supported in addition to the standard scopes "singleton" and "prototype".

  See Also:
    Constant Field Values

Method Detail

### getServletContext

    ServletContext getServletContext()

  Return the standard Servlet API ServletContext for this application.

The Spring Framework

Copyright © 2002-2008 The Spring Framework.