Class DefaultUploadValidationService
java.lang.Object
org.hippoecm.frontend.plugins.yui.upload.validation.DefaultUploadValidationService
- All Implemented Interfaces:
Serializable
,org.apache.wicket.util.io.IClusterable
,FileUploadValidationService
,IValidationService
- Direct Known Subclasses:
ImageUploadValidationService
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
Fields inherited from interface org.hippoecm.frontend.plugins.yui.upload.validation.FileUploadValidationService
DEFAULT_EXTENSIONS_ALLOWED, DEFAULT_MAX_FILE_SIZE
Fields inherited from interface org.hippoecm.frontend.validation.IValidationService
VALIDATE_ID
-
Constructor Summary
ConstructorDescriptionDefaultUploadValidationService
(org.apache.wicket.util.value.IValueMap params) -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
void
addViolation
(String key, Object... params) String[]
protected String[]
protected String
Check if the defaultMaximumUploadSize stored in the ApplicationSettings is set explicitly and only then used it, otherwise use DEFAULT_MAX_FILE_SIZE.org.apache.wicket.util.lang.Bytes
static FileUploadValidationService
getValidationService
(IPluginContext pluginContext, IPluginConfig pluginConfig, String defaultValidationServiceId) Get the validation service specified by the parameterIValidationService.VALIDATE_ID
in the plugin config.void
setAllowedExtensions
(String[] extensions) void
setAllowedMimeTypes
(String[] mimeTypes) Deprecated.since 14.7.0 : setting allowed mime types does not do anything any morevoid
validate()
final void
validate
(org.apache.wicket.markup.html.form.upload.FileUpload upload)
-
Field Details
-
MAX_FILE_SIZE
- See Also:
-
EXTENSIONS_ALLOWED
- See Also:
-
EXTENSION_MIMETYPE_ALLOWED_MAPPINGS
- See Also:
-
MIME_TYPES_ALLOWED
- See Also:
-
-
Constructor Details
-
DefaultUploadValidationService
public DefaultUploadValidationService() -
DefaultUploadValidationService
public DefaultUploadValidationService(org.apache.wicket.util.value.IValueMap params)
-
-
Method Details
-
addValidator
-
validate
public final void validate(org.apache.wicket.markup.html.form.upload.FileUpload upload) throws ValidationException - Specified by:
validate
in interfaceFileUploadValidationService
- Throws:
ValidationException
-
validate
- Specified by:
validate
in interfaceIValidationService
- Throws:
ValidationException
-
getValidationResult
- Specified by:
getValidationResult
in interfaceIValidationService
-
addViolation
- Specified by:
addViolation
in interfaceFileUploadValidationService
-
setAllowedMimeTypes
Deprecated.since 14.7.0 : setting allowed mime types does not do anything any more -
getAllowedExtensions
- Specified by:
getAllowedExtensions
in interfaceFileUploadValidationService
-
setAllowedExtensions
- Specified by:
setAllowedExtensions
in interfaceFileUploadValidationService
-
getMaxFileSize
public org.apache.wicket.util.lang.Bytes getMaxFileSize()- Specified by:
getMaxFileSize
in interfaceFileUploadValidationService
-
getDefaultMaxFileSize
Check if the defaultMaximumUploadSize stored in the ApplicationSettings is set explicitly and only then used it, otherwise use DEFAULT_MAX_FILE_SIZE. This is because it is set to Bytes.MAX by default which is a bit overkill (8388608T).- Returns:
- The String value of the default maximum file size for an upload
-
getDefaultExtensionsAllowed
-
getValidationService
public static FileUploadValidationService getValidationService(IPluginContext pluginContext, IPluginConfig pluginConfig, String defaultValidationServiceId) Get the validation service specified by the parameterIValidationService.VALIDATE_ID
in the plugin config. If no service id configuration is found, the service with iddefaultValidationServiceId
is used. If it cannot find this service, a new default service is returned.
-