Merged V2.1 to V2.0

6435: AR-1644 Web Scripts do not provide any control over caching
   6469: Replaced EUPL licence with standard license header
   6526: AR-1685 Error creating workflow with no document associated
   6565: Fix for issue with file Upload in main web-client portlet for JBoss/Liferay portal integration.
   6578: AR-1620: Upgraded One-Jar to 0.96-RC4


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6581 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-08-20 15:46:59 +00:00
parent 4ffc28f0bf
commit 4ba65b9950
16 changed files with 449 additions and 41 deletions

View File

@@ -45,6 +45,7 @@ import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.scripts.AbstractWebScript;
import org.alfresco.web.scripts.WebScriptCache;
import org.alfresco.web.scripts.WebScriptException;
import org.alfresco.web.scripts.WebScriptRequest;
import org.alfresco.web.scripts.WebScriptResponse;
@@ -138,7 +139,6 @@ public class ContentGet extends AbstractWebScript
return;
}
}
httpRes.setDateHeader("Last-Modified", modified.getTime());
// handle attachment
if (attach == true)
@@ -174,10 +174,18 @@ public class ContentGet extends AbstractWebScript
}
}
// set mimetype for the content and the character encoding for the stream
// set mimetype for the content and the character encoding + length for the stream
httpRes.setContentType(mimetype);
httpRes.setCharacterEncoding(reader.getEncoding());
httpRes.setHeader("Content-Length", Long.toString(reader.getSize()));
// set caching
WebScriptCache cache = new WebScriptCache();
cache.setNeverCache(false);
cache.setMustRevalidate(true);
cache.setLastModified(modified);
res.setCache(cache);
// get the content and stream directly to the response output stream
// assuming the repository is capable of streaming in chunks, this should allow large files
// to be streamed directly to the browser response stream.