@Component public class FileUploadWrapper extends Object
#upload(String, WebMarkupContainer, String)
Modifier and Type | Class and Description |
---|---|
static class |
FileUploadWrapper.CompressionMeta |
Modifier and Type | Field and Description |
---|---|
static String |
UPLOAD_FILE_SIZE_MAX_KB_KEY |
Constructor and Description |
---|
FileUploadWrapper() |
Modifier and Type | Method and Description |
---|---|
static String |
constructAbsoluteDownloadPath(String path) |
static FileUploadWrapper |
get() |
String |
getDownloadPath(String savedPath)
Based on site.resources.folder.mode.relative config being absolute or relative; it constructs a 'DownloadServlet?file=' path, if absolute paths
are being used.
|
Long |
getFileUploadSizeMaxKB() |
String |
getRelativePath(String absolutePath)
Get path of the resource relative to the base folder.
|
List<String> |
getResourceFolderAbsolutePaths()
Irrespective of web-relative or not, it derives the absolute path for the resources base folder(s).
|
List<String> |
getResourceFolderbasePaths()
Default configured to property from admin configs : site.resources.folder.base
|
String |
getWebRelativePath(String path)
Get path to display to user which they can use.
|
protected void |
initStaticVariables() |
boolean |
isResourceRelativeToWebContext() |
String |
upload(org.apache.wicket.markup.html.form.upload.FileUpload fileUploadHandle,
org.apache.wicket.markup.html.WebMarkupContainer parentWebComponent,
String uploadFolder,
FileUploadWrapper.CompressionMeta compressionMeta)
Will return path Relative to Web-Context or to FileSystrem base Path (depending on Relative or Absolute configuration).
This will never return ABSOLUTE PATH. |
String |
upload(org.apache.wicket.markup.html.form.upload.FileUpload fileUploadHandle,
org.apache.wicket.markup.html.WebMarkupContainer parentWebComponent,
String uploadFolder,
String defaultAbsolutePath,
FileUploadWrapper.CompressionMeta compressionMeta,
Boolean uploadFolderIsAbsolute)
Will return path Relative to Web-Context or to FileSystrem base Path (depending on Relative or Absolute configuration).
This will never return ABSOLUTE PATH. |
String |
upload(String fileUploadFieldName,
org.apache.wicket.markup.html.WebMarkupContainer parentWebComponent,
String uploadFolder,
FileUploadWrapper.CompressionMeta compressionMeta) |
Collection<String> |
uploadMultiple(org.apache.wicket.markup.html.form.upload.MultiFileUploadField fileUploadField,
org.apache.wicket.markup.html.WebMarkupContainer parentWebComponent,
String uploadFolder,
FileUploadWrapper.CompressionMeta compressionMeta)
Upload multiple files
|
Collection<String> |
uploadMultiple(String fileUploadFieldName,
org.apache.wicket.markup.html.WebMarkupContainer parentWebComponent,
String uploadFolder,
FileUploadWrapper.CompressionMeta compressionMeta)
Upload multiple files
|
public static final String UPLOAD_FILE_SIZE_MAX_KB_KEY
@PostConstruct protected void initStaticVariables()
public String getWebRelativePath(String path) throws Exception
path
- Exception
public String getRelativePath(String absolutePath) throws Exception
absolutePath
- Exception
public List<String> getResourceFolderAbsolutePaths()
public String upload(String fileUploadFieldName, org.apache.wicket.markup.html.WebMarkupContainer parentWebComponent, String uploadFolder, FileUploadWrapper.CompressionMeta compressionMeta)
fileUploadFieldName
- as the Wicket FileUploadField
field nameparentWebComponent
- the Wicket calling this method / or container of the File Uploader (could be different). Supporting form should support Multi-Part.uploadFolder
- compressionMeta
- as FileUploadWrapper.CompressionMeta
public String upload(org.apache.wicket.markup.html.form.upload.FileUpload fileUploadHandle, org.apache.wicket.markup.html.WebMarkupContainer parentWebComponent, String uploadFolder, FileUploadWrapper.CompressionMeta compressionMeta)
fileUploadHandle
- as the Wicket FileUploadField
fieldparentWebComponent
- the Wicket calling this method / or container of the File Uploader (could be different). Supporting form should support Multi-Part.uploadFolder
- compressionMeta
- as FileUploadWrapper.CompressionMeta
public String upload(org.apache.wicket.markup.html.form.upload.FileUpload fileUploadHandle, org.apache.wicket.markup.html.WebMarkupContainer parentWebComponent, String uploadFolder, String defaultAbsolutePath, FileUploadWrapper.CompressionMeta compressionMeta, Boolean uploadFolderIsAbsolute)
fileUploadHandle
- as the Wicket FileUploadField
fieldparentWebComponent
- the Wicket calling this method / or container of the File Uploader (could be different). Supporting form should support Multi-Part. @nullable trueuploadFolder
- (should be a valid existing file or folder. If a file it will derive the parent folder from it)
isResourceRelativeToWebContext()
then this path is expected to be a relative Path to the AppSettings.get().CONTEXT_BASE_ABSOLUTE_PATHdefaultAbsolutePath
- compressionMeta
- as FileUploadWrapper.CompressionMeta
uploadFolderIsRelative
- as boolean. By Default isResourceRelativeToWebContext()
is consulted, but in certain situations even when using relative paths
we may want to supply an Absolute path. Then can supply true in that case. "null" is dont know/will imply default.public Collection<String> uploadMultiple(String fileUploadFieldName, org.apache.wicket.markup.html.WebMarkupContainer parentWebComponent, String uploadFolder, FileUploadWrapper.CompressionMeta compressionMeta)
fileUploadFieldName
- as the Wicket MultiFileUploadField
fieldparentWebComponent
- the Wicket calling this method / or container of the File Uploader (could be different). Supporting form should support Multi-Part.uploadFolder
- public Collection<String> uploadMultiple(org.apache.wicket.markup.html.form.upload.MultiFileUploadField fileUploadField, org.apache.wicket.markup.html.WebMarkupContainer parentWebComponent, String uploadFolder, FileUploadWrapper.CompressionMeta compressionMeta)
fileUploadFieldName
- as the Wicket MultiFileUploadField
field nameparentWebComponent
- the Wicket calling this method / or container of the File Uploader (could be different). Supporting form should support Multi-Part.uploadFolder
- public String getDownloadPath(String savedPath)
savedPath
- public static FileUploadWrapper get()
public boolean isResourceRelativeToWebContext()
public List<String> getResourceFolderbasePaths()
public Long getFileUploadSizeMaxKB()
Copyright © 2018. All rights reserved.