final CacheControl cacheControl = cacheState.getCacheControl();
//Get the portlet descriptor
final IPortletEntity entity = portletWindow.getPortletEntity();
final IPortletDefinitionId definitionId = entity.getPortletDefinitionId();
final PortletDefinition portletDescriptor = this.portletDefinitionRegistry.getParentPortletDescriptor(definitionId);
//Set the default scope
final String cacheScopeValue = portletDescriptor.getCacheScope();
if (MimeResponse.PUBLIC_SCOPE.equalsIgnoreCase(cacheScopeValue)) {
cacheControl.setPublicScope(true);
}
//Set the default expiration time
cacheControl.setExpirationTime(portletDescriptor.getExpirationCache());
// Use the request etag if it exists (implies useHttpHeaders==true)
if (etagHeader != null) {
cacheControl.setETag(etagHeader);
cacheState.setBrowserSetEtag(true);