Package com.jalios.jcms.upload
Class UploadManager
java.lang.Object
com.jalios.jcms.upload.UploadManager
- All Implemented Interfaces:
JPropertiesListener
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd all required CSS and JS files needed for an upload component to the current JSP contextAll file-document.icon.* from jcms.prop as json prop (key,value) :static UploadManagergetMaxUploadSizePermissionsByMimeType(String mimeType) Returns the maximum upload size allowed for a given MIME type.getUploadComponent(JcmsJspContext ctxt, String pfield) Returns a String HTML component for upload.getUploadComponent(JcmsJspContext ctxt, String pfield, String pdrop, String pbrowse, boolean showFiles, boolean showLogs) Returns a String HTML component for upload.getUploadedFile(JcmsContext ctxt, String field, boolean isFileDocument, boolean override) Deprecated.getUploadedFileList(JcmsContext ctxt, String field, boolean isFileDocument, boolean override) Deprecated.getUploadedFiles(JcmsContext ctxt, String field, FileUploadOptions options) Performs upload for file received for the specified field.voidvoidvoidpropertiesChange(JProperties properties) Invoked after properties have been modified in JCMS and save on disk.voidremoveAllFileItem(JcmsJspContext ctxt, String token, String field) org.apache.commons.fileupload.FileItemremoveFileItem(JcmsJspContext ctxt, String token, String field, String filename) Remove from session the first FileItem with the given nameretrieveFileItem(JcmsContext ctxt, String token, String field) Retrieve from session FileItem or List stored in sessionretrieveUploadedFile(org.apache.commons.fileupload.FileItem item, boolean isFileDocument, boolean override) Deprecated.voidstoreFileItem(JcmsJspContext ctxt, String token, String field, org.apache.commons.fileupload.FileItem fileItem) Store the given FileItem in session to be retrieved later by DocUpload mechanism.
-
Field Details
-
PLUPLOAD_VERSION
- See Also:
-
-
Method Details
-
getInstance
-
propertiesChange
Description copied from interface:JPropertiesListenerInvoked after properties have been modified in JCMS and save on disk.You cannot alter the value received in parameters.
Note that properties parameter may be null, a limited set of site properties, or all site properties.
To check that a property has been modified, reload the "current" property instead using
channel.getPropertiesorchannel.getProperty.- Specified by:
propertiesChangein interfaceJPropertiesListener- Parameters:
properties- the properties which have been submitted to change
-
initMaxUploadSizePermissionsMap
public void initMaxUploadSizePermissionsMap() -
initExtensionIconsMap
public void initExtensionIconsMap() -
addUploadComponentScripts
Add all required CSS and JS files needed for an upload component to the current JSP context- Parameters:
ctxt- the current JcmsJspContext, must not be nuill
-
getUploadComponent
Returns a String HTML component for upload. Declare required css/js code.- Parameters:
ctxt- the JcmsJspContextpfield- the field name- Returns:
- an HTML component as a String
-
getUploadComponent
public String getUploadComponent(JcmsJspContext ctxt, String pfield, String pdrop, String pbrowse, boolean showFiles, boolean showLogs) Returns a String HTML component for upload. Declare required css/js code.- Parameters:
ctxt- the JcmsJspContextpfield- the field namepdrop- (optional) label of the drop box (set null to bypass)pbrowse- (optional) label of the browse button (set null to bypass)showFiles- boolean true to generate list of filesshowLogs- boolean true to generate logs- Returns:
- an HTML component as a String
-
getUploadedFiles
public List<DocUploadInfo> getUploadedFiles(JcmsContext ctxt, String field, FileUploadOptions options) Performs upload for file received for the specified field.- Parameters:
ctxt- JcmsContextfield- the submited fieldoptions- upload options- Returns:
- a List of uploaded files (DocUploadInfo), never return null
- Since:
- jcms-10.0.6 / JCMS-8317
-
getUploadedFile
@Deprecated public Object getUploadedFile(JcmsContext ctxt, String field, boolean isFileDocument, boolean override) Deprecated.Performs upload for the given field to JCMS upload directory. Calling method must handle job around file like creating or updating associated FileDocument.- Parameters:
ctxt- JcmsContextfield- the submited fieldisFileDocument- upload to a FileDocument path upload/docs/...override- If file already exists, override or rename with current timemillis- Returns:
- Object a List of uploaded files (DocUploadInfo) or a DocUploadInfo
- Since:
- jcms-5.7.0
-
getUploadedFileList
@Deprecated public List<DocUploadInfo> getUploadedFileList(JcmsContext ctxt, String field, boolean isFileDocument, boolean override) Deprecated.Performs upload for the given field to JCMS upload directory. Calling method must handle job around file like creating or updating associated FileDocument.- Parameters:
ctxt- JcmsContextfield- the submited fieldisFileDocument- upload to a FileDocument upload/docs/...override- If file already exists, override or rename with current timemillis- Returns:
- List a List of uploaded files
- Since:
- jcms-5.7.0
-
retrieveUploadedFile
@Deprecated public DocUploadInfo retrieveUploadedFile(org.apache.commons.fileupload.FileItem item, boolean isFileDocument, boolean override) Deprecated.Performs upload of a given FileItem to JCMS upload directory. Calling method must handle job around file like creating or updating associated FileDocument.- Parameters:
item- the FileItem handling uploaded file informationisFileDocument- upload to a Filedocument path upload/docs/...override- If file already exists, override or rename with current timemillis- Returns:
- DocUploadInfo the uploaded DocUploadInfo
- Since:
- jcms-5.7.0
-
storeFileItem
public void storeFileItem(JcmsJspContext ctxt, String token, String field, org.apache.commons.fileupload.FileItem fileItem) Store the given FileItem in session to be retrieved later by DocUpload mechanism.- Parameters:
ctxt- the JcmsJspContexttoken- String the token used to store the object in session. It identify the page requestfield- String the field namefileItem- the FileItem to store- Since:
- jcms-7.0.0
-
removeFileItem
public org.apache.commons.fileupload.FileItem removeFileItem(JcmsJspContext ctxt, String token, String field, String filename) Remove from session the first FileItem with the given name- Parameters:
ctxt- the JcmsJspContexttoken- String the token used to store the object in session. It identify the page requestfield- String the field namefilename- String the name of the FileItem to remove- Returns:
- FileItem the removed fileitem or null
- Since:
- jcms-7.0.0
-
removeAllFileItem
-
retrieveFileItem
Retrieve from session FileItem or List stored in session- Parameters:
ctxt- the JcmsJspContexttoken- String the token used to store the object in session. It identify the page requestfield- String the field name- Returns:
- Object FileItem, List or null
- Since:
- jcms-7.0.0
-
getExtensionIconsMap
All file-document.icon.* from jcms.prop as json prop (key,value) :- Returns:
- map value of extension icons: {key: audio/mpeg, images/jalios/icons/media/audio16.png}, ...
-
getMaxUploadSizePermissionsMap
- Returns:
- the map of max file size depending on mime type of files
- Since:
- jcms-11.0.0
-
getMaxUploadSizePermissionsByMimeType
Returns the maximum upload size allowed for a given MIME type.- Parameters:
mimeType- the MIME type of the file- Returns:
- the maximum allowed file size for the specified MIME type
-
getUploadedFiles(JcmsContext, String, FileUploadOptions)