1. /*
  2. * Copyright 2002-2004 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.springframework.web.context;
  17. import javax.servlet.ServletContext;
  18. import org.springframework.context.ApplicationContext;
  19. import org.springframework.ui.context.ThemeSource;
  20. /**
  21. * Interface to provide configuration for a web application. This is read-only while
  22. * the application is running, but may be reloaded if the implementation supports this.
  23. *
  24. * <p>This interface adds a getServletContext method to the generic ApplicationContext
  25. * interface, and defines a well-known application attribute name that the root
  26. * context must be bound to in the bootstrap process.
  27. *
  28. * <p>Like generic application contexts, web application contexts are hierarchical.
  29. * There is a single root context per application, while each servlet in the application
  30. * (including a dispatcher servlet in the MVC framework) has its own child context.
  31. *
  32. * <p>In addition to standard application context lifecycle capabilities,
  33. * WebApplicationContext implementations need to detect ServletContextAware
  34. * beans and invoke the setServletContext method accordingly.
  35. *
  36. * @author Rod Johnson
  37. * @author Juergen Hoeller
  38. * @since January 19, 2001
  39. * @version $Revision: 1.11 $
  40. * @see ServletContextAware#setServletContext
  41. */
  42. public interface WebApplicationContext extends ApplicationContext, ThemeSource {
  43. /**
  44. * Context attribute to bind root WebApplicationContext to on successful startup.
  45. * <p>Note: If the startup of the root context fails, this attribute can contain
  46. * an exception or error as value. Use WebApplicationContextUtils for convenient
  47. * lookup of the root WebApplicationContext.
  48. * @see org.springframework.web.context.support.WebApplicationContextUtils#getWebApplicationContext
  49. * @see org.springframework.web.context.support.WebApplicationContextUtils#getRequiredWebApplicationContext
  50. */
  51. String ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE = WebApplicationContext.class + ".ROOT";
  52. /**
  53. * Return the standard Servlet API ServletContext for this application.
  54. */
  55. ServletContext getServletContext();
  56. }