public class FileUploadHandler extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FileUploadHandler.FileMeta |
| Constructor and Description |
|---|
FileUploadHandler() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getResourcePath(String path,
boolean pathIsRelative,
String defaultAbsolutePath,
String name)
Get path for resource
|
static FileUploadHandler.FileMeta |
handleFileUpload(org.apache.wicket.markup.html.form.upload.FileUpload upload,
String path,
boolean pathIsRelative,
String defaultAbsolutePath)
Helper to tidy up file Upload code.
|
public static String getResourcePath(String path, boolean pathIsRelative, String defaultAbsolutePath, String name)
path - as String (the path of the file/folder to store the file - relative). If a file it will derive the folder and consume that.
If pathIsRelative then this path is expected to be a relative Path to the AppSettings.get().CONTEXT_BASE_ABSOLUTE_PATH
Note: the path must exist on the system else the default is returned.pathIsRelative - as boolean (true if the path is relative to web context)defaultAbsolutePath - as Default folder path If any problem in knowing web-relative folder path. In the case of Non-Relative URI's this is the base path for the file. For absolute paths this is base pathname - of the Resourcepublic static FileUploadHandler.FileMeta handleFileUpload(org.apache.wicket.markup.html.form.upload.FileUpload upload, String path, boolean pathIsRelative, String defaultAbsolutePath) throws Exception
upload - as FileUpload File to Uploadpath - as String (the path of the folder to store the file)
If pathIsRelative then this path is expected to be a relative Path to the AppSettings.get().CONTEXT_BASE_ABSOLUTE_PATHpathIsRelative - as boolean (true if the path is relative to web context)defaultAbsolutePath - as Default folder path If any problem in knowing web-relative folder path. In the case of Non-Relative URI's this is the base path for the file. For absolute paths this is base pathFileUploadHandler.FileMeta with Final path of file on Server (@nullable true) (relative to web-context(when pathIsRelative=true) else full path to file is returned)ExceptionCopyright © 2018. All rights reserved.