org.springframework.web.servlet.support
Class WebContentGenerator

org.springframework.context.support.ApplicationObjectSupport
  |
  +--org.springframework.web.context.support.WebApplicationObjectSupport
        |
        +--org.springframework.web.servlet.support.WebContentGenerator
Direct Known Subclasses:
AbstractController, WebContentInterceptor

public abstract class WebContentGenerator
extends WebApplicationObjectSupport

Convenient superclass for any kind of web content generator, like AbstractController and WebContentInterceptor.

Supports HTTP cache control options. The usage of corresponding HTTP headers can be determined via the "useExpiresHeader" and "userCacheControlHeader" properties.

Author:
Rod Johnson, Juergen Hoeller
See Also: setUseExpiresHeader(boolean), setUseCacheControlHeader(boolean)

Field Summary
 final static StringHEADER_CACHE_CONTROL
           
 final static StringHEADER_EXPIRES
           
 final static StringHEADER_PRAGMA
           
 final static StringMETHOD_GET
           
 final static StringMETHOD_POST
           

Constructor Summary
WebContentGenerator()
          Create a new Controller supporting GET and POST methods.

Method Summary
 final voidsetCacheSeconds(int seconds)
          If 0 disable caching, default is no caching header generation.
 final voidsetRequireSession(boolean requireSession)
          Set if a session should be required to handle requests.
 final voidsetSupportedMethods(String[] supportedMethodsArray)
          Set the HTTP methods that this content generator should support.
 final voidsetUseCacheControlHeader(boolean useCacheControlHeader)
          Set whether to use the HTTP 1.1 cache-control header.
 final voidsetUseExpiresHeader(boolean useExpiresHeader)
          Set whether to use the HTTP 1.0 expires header.

Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, setApplicationContext

Field Detail

HEADER_CACHE_CONTROL

public final static String HEADER_CACHE_CONTROL

HEADER_EXPIRES

public final static String HEADER_EXPIRES

HEADER_PRAGMA

public final static String HEADER_PRAGMA

METHOD_GET

public final static String METHOD_GET

METHOD_POST

public final static String METHOD_POST
Constructor Detail

WebContentGenerator

public WebContentGenerator()
Create a new Controller supporting GET and POST methods.
Method Detail

setCacheSeconds

public final void setCacheSeconds(int seconds)
If 0 disable caching, default is no caching header generation. Only if this is set to 0 (no cache) or a positive value (cache for this many seconds) will this class generate cache headers. They can be overwritten by subclasses anyway, before content is generated.

setRequireSession

public final void setRequireSession(boolean requireSession)
Set if a session should be required to handle requests.

setSupportedMethods

public final void setSupportedMethods(String[] supportedMethodsArray)
Set the HTTP methods that this content generator should support. Default is GET and POST.

setUseCacheControlHeader

public final void setUseCacheControlHeader(boolean useCacheControlHeader)
Set whether to use the HTTP 1.1 cache-control header. Default is true.

Note: Cache headers will only get applied if caching is enabled for the current request.


setUseExpiresHeader

public final void setUseExpiresHeader(boolean useExpiresHeader)
Set whether to use the HTTP 1.0 expires header. Default is true.

Note: Cache headers will only get applied if caching is enabled for the current request.

Association Links

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.util.Set

Set of supported methods. GET and POST by default.