Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.platform.ui.web.component.file
Class InputFileMimetypeValidator

java.lang.Object
  extended by org.nuxeo.ecm.platform.ui.web.component.file.InputFileMimetypeValidator
All Implemented Interfaces:
java.util.EventListener, javax.faces.component.StateHolder, javax.faces.validator.Validator

public class InputFileMimetypeValidator
extends java.lang.Object
implements javax.faces.validator.Validator, javax.faces.component.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

Field Summary
static java.lang.String MIMETYPE_AUTHORIZED_EXTENSIONS_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the authorized extensions check fails.
static java.lang.String MIMETYPE_UNAUTHORIZED_EXTENSIONS_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the unauthorized extensions check fails.
static java.lang.String VALIDATOR_ID
           
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
InputFileMimetypeValidator()
           
 
Method Summary
 java.lang.String[] getExtensions()
           
 boolean isAuthorized()
           
 boolean isTransient()
           
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setAuthorized(boolean authorized)
           
 void setExtensions(java.lang.String[] extensions)
           
 void setTransient(boolean newTransientValue)
           
 void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATOR_ID

public static final java.lang.String VALIDATOR_ID
See Also:
Constant Field Values

MIMETYPE_AUTHORIZED_EXTENSIONS_MESSAGE_ID

public static final java.lang.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:

See Also:
Constant Field Values

MIMETYPE_UNAUTHORIZED_EXTENSIONS_MESSAGE_ID

public static final java.lang.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:

See Also:
Constant Field Values
Constructor Detail

InputFileMimetypeValidator

public InputFileMimetypeValidator()
Method Detail

validate

public void validate(javax.faces.context.FacesContext context,
                     javax.faces.component.UIComponent component,
                     java.lang.Object value)
              throws javax.faces.validator.ValidatorException
Specified by:
validate in interface javax.faces.validator.Validator
Throws:
javax.faces.validator.ValidatorException

getExtensions

public java.lang.String[] getExtensions()

setExtensions

public void setExtensions(java.lang.String[] extensions)

isAuthorized

public boolean isAuthorized()

setAuthorized

public void setAuthorized(boolean authorized)

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

public void setTransient(boolean newTransientValue)
Specified by:
setTransient in interface javax.faces.component.StateHolder

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.