public class DownloadHelper extends Object
Modifier and Type | Method and Description |
---|---|
static String |
getRFC2231ContentDisposition(javax.servlet.http.HttpServletRequest request,
String filename)
Generates a
Content-Disposition string based on the servlet request for a given filename. |
static String |
getRFC2231ContentDisposition(javax.servlet.http.HttpServletRequest request,
String filename,
Boolean inline)
Generates a
Content-Disposition string for a given filename. |
static void |
handleClientDisconnect(IOException e)
Re-throws the passed exception except if it corresponds to a client disconnect, for which logging doesn't bring
us anything.
|
static boolean |
isClientAbortError(Throwable t) |
static void |
logClientAbort(Exception e) |
static DownloadService.ByteRange |
parseRange(String range,
long length)
Parses a byte range.
|
public static final String INLINE
public static DownloadService.ByteRange parseRange(String range, long length)
range
- the byte range as a stringlength
- the file lengthnull
if it couldn't be parsed.public static String getRFC2231ContentDisposition(javax.servlet.http.HttpServletRequest request, String filename)
Content-Disposition
string based on the servlet request for a given filename.
The value follows RFC2231.
request
- the http servlet requestfilename
- the filenameContent-Disposition
headerpublic static String getRFC2231ContentDisposition(javax.servlet.http.HttpServletRequest request, String filename, Boolean inline)
Content-Disposition
string for a given filename.
The value follows RFC2231.
request
- the http servlet requestfilename
- the filenameinline
- how to set the content disposition; TRUE
for inline
, FALSE
for
attachment
, or null
to detect from inline
request parameter or attributeContent-Disposition
headerpublic static boolean isClientAbortError(Throwable t)
public static void logClientAbort(Exception e)
public static void handleClientDisconnect(IOException e) throws IOException
e
- the original exceptionIOException
- if this is not a client disconnectCopyright © 2018 Nuxeo. All rights reserved.