public class DirectoryAsynchronousUploadHandler extends Object implements fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler
jessionid
parameter should be the REAL session id, not the flash player one. The uploaded
files are deleted by SubForm when filling fields.Modifier and Type | Field and Description |
---|---|
static Map<String,Map<String,List<org.apache.commons.fileupload.FileItem>>> |
_mapAsynchronousUpload
<sessionId,<fieldName,fileItems>>
|
Modifier and Type | Method and Description |
---|---|
void |
addFileItemToUploadedFile(org.apache.commons.fileupload.FileItem fileItem,
String strIdEntry,
javax.servlet.http.HttpSession session)
Add file item to the list of uploaded files
|
String |
buildFieldName(String strIdEntry)
Build the field name from a given id entry i.e.
|
void |
doDeleteFile(javax.servlet.http.HttpServletRequest request,
String strIdEntry,
Map<String,List<RecordField>> map)
Deletes a file
|
org.apache.commons.fileupload.FileItem |
doDownloadFile(String strUrl)
Do download the file
|
void |
doDownloadFile(String strUrl,
String strFilePath)
Do download the file
|
void |
doRemoveFile(RecordField recordField,
IEntry entry,
String strWSRestUrl)
Do remove a file from a given record field
|
void |
doRemoveFile(Record record,
IEntry entry,
String strWSRestUrl)
Do remove a file from a given record and entry
|
void |
doUploadAction(javax.servlet.http.HttpServletRequest request,
String strUploadAction,
Map<String,List<RecordField>> map)
Performs an upload action.
|
void |
doUploadAction(javax.servlet.http.HttpServletRequest request,
String strUploadAction,
Map<String,List<RecordField>> map,
Record record,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Performs an upload action.
|
void |
doUploadFile(javax.servlet.http.HttpServletRequest request,
String strIdEntry,
Map<String,List<RecordField>> map)
Uploads a file
|
void |
doUploadFile(javax.servlet.http.HttpServletRequest request,
String strIdEntry,
Map<String,List<RecordField>> map,
Record record)
Uploads a file
|
String |
doUploadFile(String strBaseUrl,
org.apache.commons.fileupload.FileItem fileItem,
String strBlobStore)
Do upload a file in the blobstore webapp
|
List<org.apache.commons.fileupload.FileItem> |
getFileItems(String strIdEntry,
String strSessionId)
Gets the fileItem for the entry and the given session.
|
String |
getFileName(String strUrl)
Get the file name from a given url
|
String |
getFileUrl(String strBaseUrl,
String strBlobKey,
String strBlobStore)
Get the file url
|
static DirectoryAsynchronousUploadHandler |
getHandler()
Get the handler
|
String |
getUploadAction(javax.servlet.http.HttpServletRequest request)
Checks the request parameters to see if an upload submit has been called.
|
boolean |
isBlobStoreClientServiceAvailable()
Check if the service is available
|
boolean |
isInvoked(javax.servlet.http.HttpServletRequest request) |
void |
process(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
net.sf.json.JSONObject mainObject,
List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload)
category CALLED_BY_JS (directoryupload.js)
|
void |
reinitMap(javax.servlet.http.HttpServletRequest request,
Map<String,List<RecordField>> map,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Reinit the map with the default files stored in database and blobstore
|
void |
removeFileItem(String strIdEntry,
String strSessionId,
int nIndex)
Removes the file from the list.
|
void |
removeSessionFiles(String strSessionId)
Removes all files associated to the session
|
void |
setBlobStoreClientService(fr.paris.lutece.plugins.blobstore.service.IBlobStoreClientService blobStoreClientService)
Set the blobstore client service
|
public static DirectoryAsynchronousUploadHandler getHandler()
public void setBlobStoreClientService(fr.paris.lutece.plugins.blobstore.service.IBlobStoreClientService blobStoreClientService)
blobStoreClientService
- the blob store client servicepublic boolean isInvoked(javax.servlet.http.HttpServletRequest request)
isInvoked
in interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler
public boolean isBlobStoreClientServiceAvailable()
public void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.sf.json.JSONObject mainObject, List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload)
process
in interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler
public String doUploadFile(String strBaseUrl, org.apache.commons.fileupload.FileItem fileItem, String strBlobStore) throws fr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
strBaseUrl
- the base urlfileItem
- the filestrBlobStore
- the blobstore service namefr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
- Exception if there is an issuepublic void doRemoveFile(Record record, IEntry entry, String strWSRestUrl) throws fr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
record
- the recordentry
- the entrystrWSRestUrl
- the url of the WS restfr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
- Exception if there is an issuepublic void doRemoveFile(RecordField recordField, IEntry entry, String strWSRestUrl) throws fr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
recordField
- the record fieldentry
- the entrystrWSRestUrl
- the url of the WS restfr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
- Exception if there is an issuepublic String getFileUrl(String strBaseUrl, String strBlobKey, String strBlobStore) throws fr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
strBaseUrl
- the base urlstrBlobKey
- the blob keystrBlobStore
- the blobstore service namefr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
- Exception if there is an issuepublic String getFileName(String strUrl) throws fr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
strUrl
- the urlfr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
- Exception if there is an issuepublic void doDownloadFile(String strUrl, String strFilePath) throws fr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
strUrl
- the file of the file to downloadstrFilePath
- the file path to downloadfr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
- exception if there is an errorpublic org.apache.commons.fileupload.FileItem doDownloadFile(String strUrl) throws fr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
strUrl
- the file of the file to downloadFileItem
fr.paris.lutece.plugins.blobstore.service.BlobStoreClientException
- exception if there is an errorpublic List<org.apache.commons.fileupload.FileItem> getFileItems(String strIdEntry, String strSessionId)
strIdEntry
- the entrystrSessionId
- the session idnull
otherwise.public void removeFileItem(String strIdEntry, String strSessionId, int nIndex)
strIdEntry
- the entry idstrSessionId
- the session idnIndex
- the n indexpublic void removeSessionFiles(String strSessionId)
strSessionId
- the session idpublic void addFileItemToUploadedFile(org.apache.commons.fileupload.FileItem fileItem, String strIdEntry, javax.servlet.http.HttpSession session)
fileItem
- the file itemstrIdEntry
- the id entrysession
- the sessionpublic String buildFieldName(String strIdEntry)
strIdEntry
- the id entrypublic String getUploadAction(javax.servlet.http.HttpServletRequest request)
request
- the HTTP requestpublic void doUploadAction(javax.servlet.http.HttpServletRequest request, String strUploadAction, Map<String,List<RecordField>> map, Record record, fr.paris.lutece.portal.service.plugin.Plugin plugin) throws DirectoryErrorException
request
- the HTTP requeststrUploadAction
- the name of the upload actionmap
- the map of idEntry, RecordFieldsrecord
- the recordplugin
- the pluginDirectoryErrorException
- exception if there is an errorpublic void doUploadFile(javax.servlet.http.HttpServletRequest request, String strIdEntry, Map<String,List<RecordField>> map, Record record) throws DirectoryErrorException
request
- the request containing the file to uploadstrIdEntry
- the entry id linked to the filemap
- the map of RecordFields
record
- the record on which the file is addedDirectoryErrorException
- if there is an error during the uploadpublic void doDeleteFile(javax.servlet.http.HttpServletRequest request, String strIdEntry, Map<String,List<RecordField>> map)
request
- the request containing the file to deletestrIdEntry
- the entry id linked to the filemap
- the map of RecordFields
public void doUploadAction(javax.servlet.http.HttpServletRequest request, String strUploadAction, Map<String,List<RecordField>> map) throws DirectoryErrorException
request
- the HTTP requeststrUploadAction
- the name of the upload actionmap
- the map of idEntry, RecordFieldsDirectoryErrorException
- exception if there is an errorpublic void doUploadFile(javax.servlet.http.HttpServletRequest request, String strIdEntry, Map<String,List<RecordField>> map) throws DirectoryErrorException
request
- the request containing the file to uploadstrIdEntry
- the entry id linked to the filemap
- the map of RecordFields
DirectoryErrorException
- if there is an error during the uploadpublic void reinitMap(javax.servlet.http.HttpServletRequest request, Map<String,List<RecordField>> map, fr.paris.lutece.portal.service.plugin.Plugin plugin)
request
- the HTTP requestmap
- the map idEntry, RecordFieldsplugin
- the pluginCopyright © 2020 City of Paris. All rights reserved.