org.springframework.web.context.support
Class WebApplicationObjectSupport

java.lang.Object
  extended byorg.springframework.context.support.ApplicationObjectSupport
      extended byorg.springframework.web.context.support.WebApplicationObjectSupport
All Implemented Interfaces:
ApplicationContextAware
Direct Known Subclasses:
AbstractCachingViewResolver, AbstractHandlerMapping, AbstractView, BeanNameViewResolver, TilesConfigurer, WebContentGenerator

public abstract class WebApplicationObjectSupport
extends ApplicationObjectSupport

Convenient superclass for application objects running in a WebApplicationContext. Provides getWebApplicationContext, getServletContext, and getTempDir methods.

Since:
28.08.2003
Author:
Juergen Hoeller

Field Summary
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
WebApplicationObjectSupport()
           
 
Method Summary
protected  ServletContext getServletContext()
          Return the current ServletContext.
protected  File getTempDir()
          Return the temporary directory for the current web application, as provided by the servlet container.
protected  WebApplicationContext getWebApplicationContext()
          Return the current application context as WebApplicationContext.
protected  boolean isContextRequired()
          Overrides the base class behavior to enforce running in an ApplicationContext.
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebApplicationObjectSupport

public WebApplicationObjectSupport()
Method Detail

isContextRequired

protected boolean isContextRequired()
Overrides the base class behavior to enforce running in an ApplicationContext. All accessors will throw IllegalStateException if not running in a context.

Overrides:
isContextRequired in class ApplicationObjectSupport
See Also:
ApplicationObjectSupport.getApplicationContext(), ApplicationObjectSupport.getMessageSourceAccessor(), getWebApplicationContext(), getServletContext(), getTempDir()

getWebApplicationContext

protected final WebApplicationContext getWebApplicationContext()
                                                        throws IllegalStateException
Return the current application context as WebApplicationContext.

Throws:
IllegalStateException - if not running in a WebApplicationContext

getServletContext

protected final ServletContext getServletContext()
Return the current ServletContext.

Throws:
IllegalStateException - if not running in a WebApplicationContext

getTempDir

protected final File getTempDir()
Return the temporary directory for the current web application, as provided by the servlet container.

Returns:
the File representing the temporary directory
Throws:
IllegalStateException - if not running in a WebApplicationContext


Copyright (C) 2003-2004 The Spring Framework Project.