Package org.nuxeo.ecm.core.io.download
Class DownloadHelper
java.lang.Object
org.nuxeo.ecm.core.io.download.DownloadHelper
Helper class related to the download service.
- Since:
- 7.3
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetContentTypeHeader(Blob blob) Gets the Content-Type header for the given blob, per RFC 2616.static StringgetRFC2231ContentDisposition(jakarta.servlet.http.HttpServletRequest request, String filename) Generates aContent-Dispositionstring based on the servlet request for a given filename.static StringgetRFC2231ContentDisposition(jakarta.servlet.http.HttpServletRequest request, String filename, Boolean inline) Generates aContent-Dispositionstring for a given filename.static voidRe-throws the passed exception except if it corresponds to a client disconnect, for which logging doesn't bring us anything.static booleanstatic voidstatic ByteRangeparseRange(String range, long length) Parses a byte range.
-
Field Details
-
INLINE
- See Also:
-
-
Method Details
-
parseRange
Parses a byte range.- Parameters:
range- the byte range as a stringlength- the file length- Returns:
- the byte range, or
nullif it couldn't be parsed.
-
getRFC2231ContentDisposition
public static String getRFC2231ContentDisposition(jakarta.servlet.http.HttpServletRequest request, String filename) Generates aContent-Dispositionstring based on the servlet request for a given filename.The value follows RFC2231.
- Parameters:
request- the http servlet requestfilename- the filename- Returns:
- a full string to set as value of a
Content-Dispositionheader
-
getRFC2231ContentDisposition
public static String getRFC2231ContentDisposition(jakarta.servlet.http.HttpServletRequest request, String filename, Boolean inline) Generates aContent-Dispositionstring for a given filename.The value follows RFC2231.
- Parameters:
request- the http servlet requestfilename- the filenameinline- how to set the content disposition;TRUEforinline,FALSEforattachment, ornullto detect frominlinerequest parameter or attribute- Returns:
- a full string to set as value of a
Content-Dispositionheader - Since:
- 7.10
-
getContentTypeHeader
Gets the Content-Type header for the given blob, per RFC 2616.For example
application/pdfortext/plain; charset=ISO-8859-1.- Parameters:
blob- the blob- Returns:
- the header, or
nullif the blob has no content type information - Since:
- 11.1
-
isClientAbortError
-
logClientAbort
-
handleClientDisconnect
Re-throws the passed exception except if it corresponds to a client disconnect, for which logging doesn't bring us anything.- Parameters:
e- the original exception- Throws:
IOException- if this is not a client disconnect
-