org.nuxeo.ecm.platform.ui.web.component.file
Class InputFileMimetypeValidator
java.lang.Object
org.nuxeo.ecm.platform.ui.web.component.file.InputFileMimetypeValidator
- All Implemented Interfaces:
- EventListener, StateHolder, Validator
public class InputFileMimetypeValidator
- extends Object
- implements Validator, StateHolder
Input file mimetype validator.
Validates an InputFileInfo
blob value in case it's been uploaded.
Accepted mimetypes are set using the "extensions" attribute, representing the
list of accepted extension suffixes separated by commas (for instance:
".jpeg, .png").
Validation is done on the filename, no actual mimetype check is done for now.
- Author:
- Anahide Tchertchian
VALIDATOR_ID
public static final String VALIDATOR_ID
- See Also:
- Constant Field Values
MIMETYPE_AUTHORIZED_EXTENSIONS_MESSAGE_ID
public static final String MIMETYPE_AUTHORIZED_EXTENSIONS_MESSAGE_ID
- The message identifier of the
FacesMessage
to be created if the
authorized extensions check fails. The message format string for this
message may optionally include the following placeholders:
{0}
replaced by the configured auhtorized extensions.
- See Also:
- Constant Field Values
MIMETYPE_UNAUTHORIZED_EXTENSIONS_MESSAGE_ID
public static final String MIMETYPE_UNAUTHORIZED_EXTENSIONS_MESSAGE_ID
- The message identifier of the
FacesMessage
to be created if the
unauthorized extensions check fails. The message format string for this
message may optionally include the following placeholders:
{0}
replaced by the configured unauthorized
extensions.
- See Also:
- Constant Field Values
InputFileMimetypeValidator
public InputFileMimetypeValidator()
validate
public void validate(FacesContext context,
UIComponent component,
Object value)
throws ValidatorException
- Specified by:
validate
in interface Validator
- Throws:
ValidatorException
getExtensions
public String[] getExtensions()
setExtensions
public void setExtensions(String[] extensions)
isAuthorized
public boolean isAuthorized()
setAuthorized
public void setAuthorized(boolean authorized)
isHidden
public boolean isHidden()
setHidden
public void setHidden(boolean hidden)
isTransient
public boolean isTransient()
- Specified by:
isTransient
in interface StateHolder
setTransient
public void setTransient(boolean newTransientValue)
- Specified by:
setTransient
in interface StateHolder
saveState
public Object saveState(FacesContext context)
- Specified by:
saveState
in interface StateHolder
restoreState
public void restoreState(FacesContext context,
Object state)
- Specified by:
restoreState
in interface StateHolder
Copyright © 2011 Nuxeo SAS. All Rights Reserved.