public class DownloadServiceImpl extends DefaultComponent implements DownloadService
Modifier and Type | Class and Description |
---|---|
static class |
DownloadServiceImpl.DownloadPermissionRegistry |
DownloadService.ByteRange
Modifier and Type | Field and Description |
---|---|
protected static int |
DOWNLOAD_BUFFER_SIZE |
lastModified
BLOBHOLDER_0, BLOBHOLDER_PREFIX, EVENT_NAME, NXBIGBLOB, NXBIGZIPFILE, NXDOWNLOADINFO, NXFILE
Constructor and Description |
---|
DownloadServiceImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
addCacheControlHeaders(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Internet Explorer file downloads over SSL do not work with certain HTTP cache control headers
|
protected boolean |
checkPermission(DocumentModel doc,
String xpath,
Blob blob,
String reason,
Map<String,Serializable> extendedInfos)
Checks if the download is allowed based on the permissions configured.
|
void |
downloadBlob(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
DocumentModel doc,
String xpath,
Blob blob,
String filename,
String reason)
Triggers a blob download.
|
void |
downloadBlob(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
DocumentModel doc,
String xpath,
Blob blob,
String filename,
String reason,
Map<String,Serializable> extendedInfos)
Triggers a blob download.
|
protected String |
fixXPath(String xpath) |
protected static boolean |
forceNoCacheOnMSIE() |
String |
getDownloadUrl(DocumentModel doc,
String xpath,
String filename)
Gets the URL to use to download the blob at the given xpath in the given document.
|
String |
getDownloadUrl(String repositoryName,
String docId,
String xpath,
String filename)
Gets the URL to use to download the blob at the given xpath in the given document.
|
protected static NuxeoPrincipal |
getPrincipal() |
void |
logDownload(DocumentModel doc,
String xpath,
String filename,
String reason,
Map<String,Serializable> extendedInfos)
Logs a download.
|
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
Blob |
resolveBlob(DocumentModel doc,
String xpath)
Finds a document's blob given an xpath or blobholder index
|
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
activate, applicationStarted, deactivate, getAdapter, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, setModifiedNow, unregisterExtension
protected static final int DOWNLOAD_BUFFER_SIZE
public DownloadServiceImpl()
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public String getDownloadUrl(DocumentModel doc, String xpath, String filename)
DownloadService
The URL is relative to the Nuxeo Web Application context.
Returns something like nxbigfile/reponame/docuuid/blobholder:0/foo.jpg
getDownloadUrl
in interface DownloadService
doc
- the documentxpath
- the blob's xpath or blobholder index, or null
for defaultfilename
- the blob's filename, or null
for defaultpublic String getDownloadUrl(String repositoryName, String docId, String xpath, String filename)
DownloadService
The URL is relative to the Nuxeo Web Application context.
Returns something like nxbigfile/reponame/docuuid/blobholder:0/foo.jpg
getDownloadUrl
in interface DownloadService
repositoryName
- the document repositorydocId
- the document idxpath
- the blob's xpath or blobholder index, or null
for defaultfilename
- the blob's filename, or null
for defaultpublic void downloadBlob(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, DocumentModel doc, String xpath, Blob blob, String filename, String reason) throws IOException
DownloadService
downloadBlob
in interface DownloadService
doc
- the document, if availablexpath
- the blob's xpath or blobholder index, if availableblob
- the blob, if already fetchedfilename
- the filename to usereason
- the download reasonIOException
public void downloadBlob(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, DocumentModel doc, String xpath, Blob blob, String filename, String reason, Map<String,Serializable> extendedInfos) throws IOException
DownloadService
downloadBlob
in interface DownloadService
doc
- the document, if availablexpath
- the blob's xpath or blobholder index, if availableblob
- the blob, if already fetchedfilename
- the filename to usereason
- the download reasonextendedInfos
- an optional map of extended informations to logIOException
public Blob resolveBlob(DocumentModel doc, String xpath)
DownloadService
resolveBlob
in interface DownloadService
doc
- the documentxpath
- the xpath or blobholder indexnull
if not foundprotected boolean checkPermission(DocumentModel doc, String xpath, Blob blob, String reason, Map<String,Serializable> extendedInfos)
protected void addCacheControlHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
See http://support.microsoft.com/kb/323308/
What is not mentioned in the above Knowledge Base is that "Pragma: no-cache" also breaks download in MSIE over SSL
protected static boolean forceNoCacheOnMSIE()
public void logDownload(DocumentModel doc, String xpath, String filename, String reason, Map<String,Serializable> extendedInfos)
DownloadService
logDownload
in interface DownloadService
doc
- the doc for which this download occurs, if availablexpath
- the blob's xpath or blobholder index, if availablefilename
- the filenamereason
- the download reasonextendedInfos
- an optional map of extended informations to logprotected static NuxeoPrincipal getPrincipal()
Copyright © 2015 Nuxeo SA. All rights reserved.