abstractpublic class WebApplicationContextUtils (Code)
Convenience methods to retrieve the root WebApplicationContext for a given
ServletContext. This is e.g. useful for accessing a Spring context from
within custom web views or Struts actions.
Note that there are more convenient ways of accessing the root context for
many web frameworks, either part of Spring or available as external library.
This helper class is just the most generic way to access the root context.
author: Juergen Hoeller See Also:org.springframework.web.context.ContextLoader See Also: org.springframework.web.servlet.FrameworkServlet See Also: org.springframework.web.servlet.DispatcherServlet See Also: org.springframework.web.struts.ActionSupport See Also: org.springframework.web.struts.DelegatingActionProxy See Also:org.springframework.web.jsf.FacesContextUtils See Also:org.springframework.web.jsf.DelegatingVariableResolver
getRequiredWebApplicationContext(ServletContext sc) Find the root WebApplicationContext for this web application, which is
typically loaded via ContextLoaderListener or ContextLoaderServlet.
getWebApplicationContext(ServletContext sc) Find the root WebApplicationContext for this web application, which is
typically loaded via ContextLoaderListener or ContextLoaderServlet.
Find the root WebApplicationContext for this web application, which is
typically loaded via ContextLoaderListener or ContextLoaderServlet.
Will rethrow an exception that happened on root context startup,
to differentiate between a failed context startup and no context at all.
Parameters: sc - ServletContext to find the web application context for the root WebApplicationContext for this web app, or null if none See Also:org.springframework.web.context.WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE