-
Type: Improvement
-
Status: Open
-
Priority: Minor
-
Resolution: Unresolved
-
Affects Version/s: 8.3
-
Fix Version/s: QualifiedToSchedule
-
Component/s: CMIS
-
Tags:
In order for clients to download Lazy Renditions, they usually send repeated GET requests to the server until a non-"inprogress/empty" response is received once the rendition is finally built. For Lazy Renditions that take a while to build, the server can receive lots of GET requests before the Download begins. Currently, each GET request received by the server generates a Download audit event. Unfortunately, this litters the audit trail for the document. Furthermore, since the "Document Event History" in the Web UI only filters by Date, this makes it extremely difficult for users to review "significant" events in the document's history.
This problem affects both CMIS and REST downloads of Lazy Renditions.
Customer suggests the following:
that nuxeo-chemistry class NuxeoContentStream be modified as listed below. Note that It might be nice to centralize this public boolean shouldLogDownload(boolean isHeadRequest, String mimeType) logic somewhere other than in nuxeo-chemistry. This works for CMIS. I'm not sure where the similar logic exists for pure REST downloads.
public static NuxeoContentStream create(DocumentModel doc, String xpath, Blob blob, String reason, Map<String, Serializable> extendedInfos, GregorianCalendar lastModified, HttpServletRequest request) { BlobManager blobManager = Framework.getService(BlobManager.class); URI uri; try { uri = blobManager.getURI(blob, UsageHint.DOWNLOAD, request); } catch (IOException e) { throw new CmisRuntimeException("Failed to get download URI", e); } if (uri != null) { extendedInfos = new HashMap<>(extendedInfos == null ? Collections.emptyMap() : extendedInfos); extendedInfos.put("redirect", uri.toString()); } boolean isHeadRequest = isHeadRequest(request); if (!isHeadRequest) { String mimeType = blob.getMimeType(); // lazy rendition with build in-progress has blob mimeType containing "empty=true" if (mimeType == null || !mimeType.contains(EMPTY_MARKER)) { DownloadService downloadService = Framework.getService(DownloadService.class); downloadService.logDownload(doc, xpath, blob.getFilename(), reason, extendedInfos); } } if (uri == null) { return new NuxeoContentStream(blob, lastModified, isHeadRequest); } else { return new NuxeoRedirectingContentStream(blob, lastModified, isHeadRequest, uri.toString()); } }