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
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getContentTypeHeader
(Blob blob) Gets the Content-Type header for the given blob, per RFC 2616.static String
getRFC2231ContentDisposition
(javax.servlet.http.HttpServletRequest request, String filename) Generates aContent-Disposition
string based on the servlet request for a given filename.static String
getRFC2231ContentDisposition
(javax.servlet.http.HttpServletRequest request, String filename, Boolean inline) Generates aContent-Disposition
string for a given filename.static void
Re-throws the passed exception except if it corresponds to a client disconnect, for which logging doesn't bring us anything.static boolean
static void
static ByteRange
parseRange
(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
null
if it couldn't be parsed.
-
getRFC2231ContentDisposition
public static String getRFC2231ContentDisposition(javax.servlet.http.HttpServletRequest request, String filename) Generates aContent-Disposition
string 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-Disposition
header
-
getRFC2231ContentDisposition
public static String getRFC2231ContentDisposition(javax.servlet.http.HttpServletRequest request, String filename, Boolean inline) Generates aContent-Disposition
string for a given filename.The value follows RFC2231.
- Parameters:
request
- the http servlet requestfilename
- the filenameinline
- how to set the content disposition;TRUE
forinline
,FALSE
forattachment
, ornull
to detect frominline
request parameter or attribute- Returns:
- a full string to set as value of a
Content-Disposition
header - Since:
- 7.10
-
getContentTypeHeader
Gets the Content-Type header for the given blob, per RFC 2616.For example
application/pdf
ortext/plain; charset=ISO-8859-1
.- Parameters:
blob
- the blob- Returns:
- the header, or
null
if 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
-