public class TempFileManager
extends java.lang.Object
TempFileAccessServlet.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CROSS_SESSION_SESSIONID |
| Constructor and Description |
|---|
TempFileManager() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clear(HttpSession session)
Clear complete content of file manager for the current session.
|
static java.lang.String |
findTempFileContentType(HttpSession session,
java.lang.String path)
Read the content type - if it was passed when calling
saveTempFile(String, String, byte[]). |
static java.lang.String |
findTempFilePath(HttpSession session,
java.lang.String path)
Finds the location of the temp file.
|
static void |
initialize(ServletContext servletContext)
Internally called during start up of server.
|
static void |
initTempFileDirectory(java.lang.String directory)
By default the servlet temp directory is used for storing the temporary files.
|
static byte[] |
readTempFile(HttpSession session,
java.lang.String path)
Read the content of the temp file manager.
|
static java.lang.String |
saveTempFile(java.lang.String fileName,
byte[] content) |
static java.lang.String |
saveTempFile(java.lang.String fileName,
java.lang.String contentType,
byte[] content)
Extended version of
saveTempFile(String, byte[]), now
also providing the possibility to also pass the content type as
parameter. |
static java.lang.String |
saveTempFile(java.lang.String fileName,
java.lang.String contentType,
byte[] content,
java.lang.String sessionId)
Extended version of
saveTempFile(String, byte[]), now
also providing the possibility to also pass the content type as
parameter. |
static java.lang.String |
saveTempFileCrossSession(java.lang.String fileName,
java.lang.String contentType,
byte[] content)
Same as
saveTempFile(String, String, byte[]), but now saves the
content in a way that it can be late on a accessed without enforcing the caller
to be in the same session than the provider of the data. |
public static final java.lang.String CROSS_SESSION_SESSIONID
public static void initialize(ServletContext servletContext)
public static void initTempFileDirectory(java.lang.String directory)
public static byte[] readTempFile(HttpSession session,
java.lang.String path)
session - path - public static java.lang.String findTempFileContentType(HttpSession session,
java.lang.String path)
saveTempFile(String, String, byte[]).public static java.lang.String findTempFilePath(HttpSession session,
java.lang.String path)
session - path - public static java.lang.String saveTempFile(java.lang.String fileName,
byte[] content)
fileName - File name of the document. This is the file name without directory.
The temp file actually is stored in some directory with a UUID, so that
each temp file resides in its own directory.content - contentpublic static java.lang.String saveTempFile(java.lang.String fileName,
java.lang.String contentType,
byte[] content)
saveTempFile(String, byte[]), now
also providing the possibility to also pass the content type as
parameter.contentType - Content type of document. This is the one that is set as content type
in the http-request that reads the temp file. If it is not set, then
the content type will be derived from the extension of the file name.public static java.lang.String saveTempFileCrossSession(java.lang.String fileName,
java.lang.String contentType,
byte[] content)
saveTempFile(String, String, byte[]), but now saves the
content in a way that it can be late on a accessed without enforcing the caller
to be in the same session than the provider of the data.public static java.lang.String saveTempFile(java.lang.String fileName,
java.lang.String contentType,
byte[] content,
java.lang.String sessionId)
saveTempFile(String, byte[]), now
also providing the possibility to also pass the content type as
parameter. This version allows the explicit passing of a session id
as string. This makes it possible to also use this function
within a thread outside the request/response processing.sessionId - Session id of the session to store the file.public static void clear(HttpSession session)
session - Copyright © CaptainCasa Gmbh. All Rights Reserved.