Modifier and Type | Method and Description |
---|---|
static void |
configureFileBlob(Blob blob) |
static Blob |
createBlob(javax.servlet.http.Part part)
Creates a Blob from a
Part . |
static Blob |
createSerializableBlob(InputStream in,
String filename,
String mimeType)
Creates a serializable blob from a stream, with filename and mimetype detection.
|
static String |
getCleanFileName(String filename)
Returns a clean filename, stripping upload path on client side.
|
static String |
retrieveFilename(javax.servlet.http.Part part)
Helper method to retrieve filename from part, waiting for servlet-api related improvements.
|
public static Blob createSerializableBlob(InputStream in, String filename, String mimeType)
Creates a serializable FileBlob which stores data in a temporary file on the hard disk.
in
- the input stream holding datafilename
- the file name. Will be set on the blob and will used for mimetype detection.mimeType
- the detected mimetype at upload. Can be null. Will be verified by the mimetype service.public static Blob createBlob(javax.servlet.http.Part part) throws IOException
Part
.
Attempts to capture the underlying temporary file, if one exists. This needs to use reflection to avoid having dependencies on the application server.
part
- the servlet partIOException
public static String retrieveFilename(javax.servlet.http.Part part)
Filename is cleaned before being returned.
getCleanFileName(String)
public static String getCleanFileName(String filename)
Fixes NXP-544
filename
- the filenamepublic static void configureFileBlob(Blob blob)
Copyright © 2018 Nuxeo. All rights reserved.