Skip to main content

[JIRA] Created: (PORTLETSPEC3-19) Errata: Clarify when CacheControl parameters can be set

  • From: "msnicklous (JIRA)" < >
  • To:
  • Subject: [JIRA] Created: (PORTLETSPEC3-19) Errata: Clarify when CacheControl parameters can be set
  • Date: Fri, 3 May 2013 15:07:58 +0000 (UTC)
  • Auto-submitted: auto-generated

Errata: Clarify when CacheControl parameters can be set
-------------------------------------------------------

                 Key: PORTLETSPEC3-19
                 URL: https://java.net/jira/browse/PORTLETSPEC3-19
             Project: portletspec3
          Issue Type: Improvement
          Components: JSR 286 Portlet Specification Errata
            Reporter: msnicklous
            Priority: Minor


CacheControl parameters need to be set in the HTTP header before the response 
is
written. 

Working Document 3 (22.04.13) Section "PLT.22.2 Validation Cache", page 164 
line 4 states: 
-------------------------
The portlet should set the validation token, expiry time or caching scope 
before
writing to the output stream as otherwise portals / portlet containers may 
ignore the
values.
-------------------------

This is correct. However, the example right below that shows such parameters 
being set
in the doView method:

-------------------------
protected void doView (RenderRequest request, RenderResponse response)
throws PortletException, java.io.IOException 
{
...
if ( request.getETag() != null ) { // validation request
if ( markupIsStillValid(request.getETag()) ) {
// markup is still valid
response.getCacheControl().setExpirationTime(30);
response.getCacheControl().setUseCachedContent(true);
return;
}
}
// create new content with new validation tag
response.getCacheControl().setETag(someID);
response.getCacheControl().setExpirationTime(60);
PortletRequestDispatcher rd =
getPortletContext().getPortletRequestDispatcher("jsp/view.jsp");
rd.include(request, response);
}
-------------------------

In general, this example would not work. Instead, the example code should 
appear in the doHeaders method, as follows:

Corrected:
-------------------------
protected void doHeaders (RenderRequest request, RenderResponse response)
{
...
if ( request.getETag() != null ) { // validation request
if ( markupIsStillValid(request.getETag()) ) {
// markup is still valid
response.getCacheControl().setExpirationTime(30);
response.getCacheControl().setUseCachedContent(true);
return;
}
}
// create new content with new validation tag
response.getCacheControl().setETag(someID);
response.getCacheControl().setExpirationTime(60);
PortletRequestDispatcher rd =
getPortletContext().getPortletRequestDispatcher("jsp/view.jsp");
rd.include(request, response);
}
-------------------------


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[JIRA] Created: (PORTLETSPEC3-19) Errata: Clarify when CacheControl parameters can be set

msnicklous (JIRA) 05/03/2013

[JIRA] Commented: (PORTLETSPEC3-19) Errata: Clarify when CacheControl parameters can be set

Neil Griffin (JIRA) 05/14/2013

[JIRA] Assigned: (PORTLETSPEC3-19) Errata: Clarify when CacheControl parameters can be set

msnicklous (JIRA) 05/21/2013

[JIRA] Updated: (PORTLETSPEC3-19) Errata: Clarify when CacheControl parameters can be set

Neil Griffin (JIRA) 05/21/2013
 
 
Close
loading
Please Confirm
Close