public abstract class

PortletContentGenerator

extends PortletApplicationObjectSupport
java.lang.Object
   ↳ org.springframework.context.support.ApplicationObjectSupport
     ↳ org.springframework.web.portlet.context.PortletApplicationObjectSupport
       ↳ org.springframework.web.portlet.handler.PortletContentGenerator
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Convenient superclass for any kind of web content generator, like AbstractController. Can also be used for custom handlers that have their own HandlerAdapter.

Supports portlet cache control options.

Summary

[Expand]
Inherited Fields
From class org.springframework.context.support.ApplicationObjectSupport
Public Constructors
PortletContentGenerator()
Public Methods
final int getCacheSeconds()
Return the number of seconds that content is cached.
final boolean isRequireSession()
Return whether a session is required to handle requests.
final void setCacheSeconds(int seconds)
Cache content for the given number of seconds.
final void setRequireSession(boolean requireSession)
Set whether a session should be required to handle requests.
Protected Methods
final void applyCacheSeconds(MimeResponse response, int seconds)
Apply the given cache seconds to the render response
final void cacheForSeconds(MimeResponse response, int seconds)
Set portlet response to allow caching for the given number of seconds.
final void check(PortletRequest request, PortletResponse response)
Check and prepare the given request and response according to the settings of this generator.
final void checkAndPrepare(PortletRequest request, MimeResponse response)
Check and prepare the given request and response according to the settings of this generator.
final void checkAndPrepare(PortletRequest request, MimeResponse response, int cacheSeconds)
Check and prepare the given request and response according to the settings of this generator.
final void preventCaching(MimeResponse response)
Prevent the render response from being cached.
[Expand]
Inherited Methods
From class org.springframework.web.portlet.context.PortletApplicationObjectSupport
From class org.springframework.context.support.ApplicationObjectSupport
From class java.lang.Object
From interface org.springframework.context.ApplicationContextAware
From interface org.springframework.web.portlet.context.PortletContextAware

Public Constructors

public PortletContentGenerator ()

Public Methods

public final int getCacheSeconds ()

Return the number of seconds that content is cached.

public final boolean isRequireSession ()

Return whether a session is required to handle requests.

public final void setCacheSeconds (int seconds)

Cache content for the given number of seconds. Default is -1, indicating no override of portlet content caching.

Only if this is set to 0 (no cache) or a positive value (cache for this many seconds) will this class override the portlet settings.

The cache setting can be overwritten by subclasses, before content is generated.

public final void setRequireSession (boolean requireSession)

Set whether a session should be required to handle requests.

Protected Methods

protected final void applyCacheSeconds (MimeResponse response, int seconds)

Apply the given cache seconds to the render response

Parameters
response current portlet render response
seconds positive number of seconds into the future that the response should be cacheable for, 0 to prevent caching

protected final void cacheForSeconds (MimeResponse response, int seconds)

Set portlet response to allow caching for the given number of seconds.

Parameters
response current portlet render response
seconds number of seconds into the future that the response should be cacheable for

protected final void check (PortletRequest request, PortletResponse response)

Check and prepare the given request and response according to the settings of this generator. Checks for a required session, and applies the number of cache seconds configured for this generator (if it is a render request/response).

Parameters
request current portlet request
response current portlet response
Throws
if the request cannot be handled because a check failed
PortletException

protected final void checkAndPrepare (PortletRequest request, MimeResponse response)

Check and prepare the given request and response according to the settings of this generator. Checks for a required session, and applies the number of cache seconds configured for this generator (if it is a render request/response).

Parameters
request current portlet request
response current portlet response
Throws
if the request cannot be handled because a check failed
PortletException

protected final void checkAndPrepare (PortletRequest request, MimeResponse response, int cacheSeconds)

Check and prepare the given request and response according to the settings of this generator. Checks for a required session, and applies the given number of cache seconds (if it is a render request/response).

Parameters
request current portlet request
response current portlet response
cacheSeconds positive number of seconds into the future that the response should be cacheable for, 0 to prevent caching
Throws
if the request cannot be handled because a check failed
PortletException

protected final void preventCaching (MimeResponse response)

Prevent the render response from being cached.