public abstract class PortletContentGenerator extends PortletApplicationObjectSupport
AbstractController
.
Can also be used for custom handlers that have their own
HandlerAdapter
.
Supports portlet cache control options.
setCacheSeconds(int)
,
setRequireSession(boolean)
logger
Constructor and Description |
---|
PortletContentGenerator() |
Modifier and Type | Method and Description |
---|---|
protected void |
applyCacheSeconds(MimeResponse response,
int seconds)
Apply the given cache seconds to the render response
|
protected void |
cacheForSeconds(MimeResponse response,
int seconds)
Set portlet response to allow caching for the given number of seconds.
|
protected void |
check(PortletRequest request,
PortletResponse response)
Check and prepare the given request and response according to the settings
of this generator.
|
protected void |
checkAndPrepare(PortletRequest request,
MimeResponse response)
Check and prepare the given request and response according to the settings
of this generator.
|
protected void |
checkAndPrepare(PortletRequest request,
MimeResponse response,
int cacheSeconds)
Check and prepare the given request and response according to the settings
of this generator.
|
int |
getCacheSeconds()
Return the number of seconds that content is cached.
|
boolean |
isRequireSession()
Return whether a session is required to handle requests.
|
protected void |
preventCaching(MimeResponse response)
Prevent the render response from being cached.
|
void |
setCacheSeconds(int seconds)
Cache content for the given number of seconds.
|
void |
setRequireSession(boolean requireSession)
Set whether a session should be required to handle requests.
|
getPortletContext, getTempDir, isContextRequired, setPortletContext
getApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, requiredContextClass, setApplicationContext
public final void setRequireSession(boolean requireSession)
public final boolean isRequireSession()
public final void setCacheSeconds(int seconds)
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 int getCacheSeconds()
protected final void check(PortletRequest request, PortletResponse response) throws PortletException
request
- current portlet requestresponse
- current portlet responsePortletException
- if the request cannot be handled because a check failedprotected final void checkAndPrepare(PortletRequest request, MimeResponse response) throws PortletException
request
- current portlet requestresponse
- current portlet responsePortletException
- if the request cannot be handled because a check failedprotected final void checkAndPrepare(PortletRequest request, MimeResponse response, int cacheSeconds) throws PortletException
request
- current portlet requestresponse
- current portlet responsecacheSeconds
- positive number of seconds into the future that the
response should be cacheable for, 0 to prevent cachingPortletException
- if the request cannot be handled because a check failedprotected final void preventCaching(MimeResponse response)
protected final void cacheForSeconds(MimeResponse response, int seconds)
response
- current portlet render responseseconds
- number of seconds into the future that the response
should be cacheable forprotected final void applyCacheSeconds(MimeResponse response, int seconds)
response
- current portlet render responseseconds
- positive number of seconds into the future that the
response should be cacheable for, 0 to prevent caching