类 PortletContentGenerator
- java.lang.Object
- org.springframework.context.support.ApplicationObjectSupport
- org.springframework.web.portlet.context.PortletApplicationObjectSupport
- org.springframework.web.portlet.handler.PortletContentGenerator
- 所有已实现的接口:
Aware
,ApplicationContextAware
,PortletContextAware
public abstract class PortletContentGenerator extends PortletApplicationObjectSupport
Convenient superclass for any kind of web content generator, likeAbstractController
. Can also be used for custom handlers that have their ownHandlerAdapter
.Supports portlet cache control options.
- 从以下版本开始:
- 2.0
- 作者:
- Juergen Hoeller, John A. Lewis
- 另请参阅:
setCacheSeconds(int)
,setRequireSession(boolean)
字段概要
从类继承的字段 org.springframework.context.support.ApplicationObjectSupport
logger
构造器概要
构造器 构造器 说明 PortletContentGenerator()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected void
applyCacheSeconds(MimeResponse response, int seconds)
Apply the given cache seconds to the render responseprotected 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.从类继承的方法 org.springframework.web.portlet.context.PortletApplicationObjectSupport
getPortletContext, getTempDir, isContextRequired, setPortletContext
从类继承的方法 org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, requiredContextClass, setApplicationContext
构造器详细资料
PortletContentGenerator
public PortletContentGenerator()
方法详细资料
setRequireSession
public final void setRequireSession(boolean requireSession)
Set whether a session should be required to handle requests.
isRequireSession
public final boolean isRequireSession()
Return whether a session is required to handle requests.
setCacheSeconds
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.
getCacheSeconds
public final int getCacheSeconds()
Return the number of seconds that content is cached.
check
protected final void check(PortletRequest request, PortletResponse response) throws PortletException
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).- 参数:
request
- current portlet requestresponse
- current portlet response- 抛出:
PortletException
- if the request cannot be handled because a check failed
checkAndPrepare
protected final void checkAndPrepare(PortletRequest request, MimeResponse response) throws PortletException
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).- 参数:
request
- current portlet requestresponse
- current portlet response- 抛出:
PortletException
- if the request cannot be handled because a check failed
checkAndPrepare
protected final void checkAndPrepare(PortletRequest request, MimeResponse response, int cacheSeconds) throws PortletException
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).- 参数:
request
- current portlet requestresponse
- current portlet responsecacheSeconds
- positive number of seconds into the future that the response should be cacheable for, 0 to prevent caching- 抛出:
PortletException
- if the request cannot be handled because a check failed
preventCaching
protected final void preventCaching(MimeResponse response)
Prevent the render response from being cached.
cacheForSeconds
protected final void cacheForSeconds(MimeResponse response, int seconds)
Set portlet response to allow caching for the given number of seconds.- 参数:
response
- current portlet render responseseconds
- number of seconds into the future that the response should be cacheable for
applyCacheSeconds
protected final void applyCacheSeconds(MimeResponse response, int seconds)
Apply the given cache seconds to the render response- 参数:
response
- current portlet render responseseconds
- positive number of seconds into the future that the response should be cacheable for, 0 to prevent caching