Package com.jalios.jcms.upload
Class UploadManager
- java.lang.Object
-
- com.jalios.jcms.upload.UploadManager
-
public class UploadManager extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PLUPLOAD_VERSION
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addUploadComponentScripts(JcmsJspContext ctxt)
Add all required CSS and JS files needed for an upload component to the current JSP contextstatic UploadManager
getInstance()
Returns a UploadManager.java.lang.String
getUploadComponent(JcmsJspContext ctxt, java.lang.String pfield)
Returns a String HTML component for upload.java.lang.String
getUploadComponent(JcmsJspContext ctxt, java.lang.String pfield, java.lang.String pdrop, java.lang.String pbrowse, boolean showFiles, boolean showLogs)
Returns a String HTML component for upload.java.lang.Object
getUploadedFile(JcmsContext ctxt, java.lang.String field, boolean isFileDocument, boolean override)
Deprecated.java.util.List<DocUploadInfo>
getUploadedFileList(JcmsContext ctxt, java.lang.String field, boolean isFileDocument, boolean override)
Deprecated.java.util.List<DocUploadInfo>
getUploadedFiles(JcmsContext ctxt, java.lang.String field, FileUploadOptions options)
Performs upload for file received for the specified field.void
removeAllFileItem(JcmsJspContext ctxt, java.lang.String token, java.lang.String field)
org.apache.commons.fileupload.FileItem
removeFileItem(JcmsJspContext ctxt, java.lang.String token, java.lang.String field, java.lang.String filename)
Remove from session the first FileItem with the given namejava.lang.Object
retrieveFileItem(JcmsContext ctxt, java.lang.String token, java.lang.String field)
Retrieve from session FileItem or List stored in sessionDocUploadInfo
retrieveUploadedFile(org.apache.commons.fileupload.FileItem item, boolean isFileDocument, boolean override)
Deprecated.void
storeFileItem(JcmsJspContext ctxt, java.lang.String token, java.lang.String field, org.apache.commons.fileupload.FileItem fileItem)
Store the given FileItem in session to be retrieved later by DocUpload mechanism.
-
-
-
Field Detail
-
PLUPLOAD_VERSION
public static final java.lang.String PLUPLOAD_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static UploadManager getInstance()
Returns a UploadManager. Singleton method initalized by Channel (not synchronized)- Returns:
- PluginManager the UploadManager
-
addUploadComponentScripts
public void addUploadComponentScripts(JcmsJspContext ctxt)
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
public java.lang.String getUploadComponent(JcmsJspContext ctxt, java.lang.String pfield)
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 java.lang.String getUploadComponent(JcmsJspContext ctxt, java.lang.String pfield, java.lang.String pdrop, java.lang.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 java.util.List<DocUploadInfo> getUploadedFiles(JcmsContext ctxt, java.lang.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 java.lang.Object getUploadedFile(JcmsContext ctxt, java.lang.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 java.util.List<DocUploadInfo> getUploadedFileList(JcmsContext ctxt, java.lang.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, java.lang.String token, java.lang.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, java.lang.String token, java.lang.String field, java.lang.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
public void removeAllFileItem(JcmsJspContext ctxt, java.lang.String token, java.lang.String field)
-
retrieveFileItem
public java.lang.Object retrieveFileItem(JcmsContext ctxt, java.lang.String token, java.lang.String field)
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
-
-