public class DefaultUploadValidationService extends Object implements FileUploadValidationService
Modifier and Type | Class and Description |
---|---|
protected static interface |
DefaultUploadValidationService.Validator |
Modifier and Type | Field and Description |
---|---|
static String |
EXTENSIONS_ALLOWED |
static String |
MAX_FILE_SIZE |
static String |
MIME_TYPES_ALLOWED |
DEFAULT_EXTENSIONS_ALLOWED, DEFAULT_MAX_FILE_SIZE
VALIDATE_ID
Constructor and Description |
---|
DefaultUploadValidationService() |
DefaultUploadValidationService(org.apache.wicket.util.value.IValueMap params) |
Modifier and Type | Method and Description |
---|---|
protected void |
addValidator(DefaultUploadValidationService.Validator validator) |
void |
addViolation(String key,
Object... params) |
String[] |
getAllowedExtensions() |
protected String[] |
getDefaultExtensionsAllowed() |
protected String |
getDefaultMaxFileSize()
Check if the defaultMaximumUploadSize stored in the IApplicationSettings is set explicitly and only
then used it, otherwise use DEFAULT_MAX_FILE_SIZE.
|
org.apache.wicket.util.lang.Bytes |
getMaxFileSize() |
IValidationResult |
getValidationResult() |
static FileUploadValidationService |
getValidationService(IPluginContext pluginContext,
IPluginConfig pluginConfig,
String defaultValidationServiceId)
Get the validation service specified by the parameter
IValidationService.VALIDATE_ID in the plugin config. |
void |
setAllowedExtensions(String[] extensions) |
void |
setAllowedMimeTypes(String[] mimeTypes) |
void |
validate() |
void |
validate(org.apache.wicket.markup.html.form.upload.FileUpload upload) |
public static final String MAX_FILE_SIZE
public static final String EXTENSIONS_ALLOWED
public static final String MIME_TYPES_ALLOWED
public DefaultUploadValidationService()
public DefaultUploadValidationService(org.apache.wicket.util.value.IValueMap params)
protected final void addValidator(DefaultUploadValidationService.Validator validator)
public final void validate(org.apache.wicket.markup.html.form.upload.FileUpload upload) throws ValidationException
validate
in interface FileUploadValidationService
ValidationException
public void validate() throws ValidationException
validate
in interface IValidationService
ValidationException
public IValidationResult getValidationResult()
getValidationResult
in interface IValidationService
public void addViolation(String key, Object... params)
addViolation
in interface FileUploadValidationService
public void setAllowedMimeTypes(String[] mimeTypes)
public String[] getAllowedExtensions()
getAllowedExtensions
in interface FileUploadValidationService
public void setAllowedExtensions(String[] extensions)
setAllowedExtensions
in interface FileUploadValidationService
public org.apache.wicket.util.lang.Bytes getMaxFileSize()
getMaxFileSize
in interface FileUploadValidationService
protected String getDefaultMaxFileSize()
protected String[] getDefaultExtensionsAllowed()
public static FileUploadValidationService getValidationService(IPluginContext pluginContext, IPluginConfig pluginConfig, String defaultValidationServiceId)
IValidationService.VALIDATE_ID
in the plugin config.
If no service id configuration is found, the service with id defaultValidationServiceId
is used.
If it cannot find this service, a new default service is returned.Copyright © 2007–2017 Hippo B.V. (http://www.onehippo.com). All rights reserved.