mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ETHREEOH-274 and handling of potentially missing cm:modifiedDate property in DownloadContentServlet.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11254 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -243,20 +243,23 @@ public abstract class BaseDownloadContentServlet extends BaseServlet
|
||||
|
||||
// check If-Modified-Since header and set Last-Modified header as appropriate
|
||||
Date modified = (Date)nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED);
|
||||
long modifiedSince = req.getDateHeader("If-Modified-Since");
|
||||
if (modifiedSince > 0L)
|
||||
if (modified != null)
|
||||
{
|
||||
// round the date to the ignore millisecond value which is not supplied by header
|
||||
long modDate = (modified.getTime() / 1000L) * 1000L;
|
||||
if (modDate <= modifiedSince)
|
||||
long modifiedSince = req.getDateHeader("If-Modified-Since");
|
||||
if (modifiedSince > 0L)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Returning 304 Not Modified.");
|
||||
res.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
|
||||
return;
|
||||
// round the date to the ignore millisecond value which is not supplied by header
|
||||
long modDate = (modified.getTime() / 1000L) * 1000L;
|
||||
if (modDate <= modifiedSince)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Returning 304 Not Modified.");
|
||||
res.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
res.setDateHeader("Last-Modified", modified.getTime());
|
||||
}
|
||||
res.setDateHeader("Last-Modified", modified.getTime());
|
||||
|
||||
if (attachment == true)
|
||||
{
|
||||
|
Reference in New Issue
Block a user