Package org.apache.myfaces.tobago.validator

Examples of org.apache.myfaces.tobago.validator.FileItemValidator


    this.contentType = contentType;
  }

  protected Validator createValidator() throws JspException {
    setValidatorId(FileItemValidator.VALIDATOR_ID);
    FileItemValidator validator = (FileItemValidator) super.createValidator();

    if (maxSize != null) {
      try {
        validator.setMaxSize(Integer.parseInt(maxSize));
      } catch (NumberFormatException e) {
        // ignore
      }
    }
    if (contentType != null) {
      validator.setContentType(contentType);
    }
    return validator;
  }
View Full Code Here


  protected Validator createValidator() throws JspException {

    final FacesContext facesContext = FacesContext.getCurrentInstance();
    final Application application = facesContext.getApplication();
    final FileItemValidator validator = (FileItemValidator) application.createValidator(FileItemValidator.VALIDATOR_ID);
    final ELContext elContext = facesContext.getELContext();

    if (maxSize != null) {
      try {
        validator.setMaxSize((Integer) maxSize.getValue(elContext));
      } catch (NumberFormatException e) {
        LOG.warn(e.getMessage());
      }
    }
    if (contentType != null) {
      validator.setContentType(ComponentUtils.splitList((String) contentType.getValue(elContext)));
    }
    return validator;
  }
View Full Code Here

    this.contentType = contentType;
  }

  protected Validator createValidator() throws JspException {
    setValidatorId(FileItemValidator.VALIDATOR_ID);
    FileItemValidator validator = (FileItemValidator) super.createValidator();

    if (maxSize != null) {
      try {
        validator.setMaxSize(Integer.parseInt(maxSize));
      } catch (NumberFormatException e) {
        // ignore
      }
    }
    if (contentType != null) {
      validator.setContentType(contentType);
    }
    return validator;
  }
View Full Code Here

  public abstract boolean isContentTypeSet();

  protected Validator createValidator() throws JspException {
    setValidatorId(FileItemValidator.VALIDATOR_ID);
    FileItemValidator validator = (FileItemValidator) super.createValidator();

    if (isMaxSizeSet()) {
      try {
        validator.setMaxSize(Integer.parseInt(getMaxSizeValue()));
      } catch (NumberFormatException e) {
        // ignore
      }
    }
    if (isContentTypeSet()) {
      validator.setContentType(ComponentUtils.splitList(getContentTypeValue()));
    }
    return validator;
  }
View Full Code Here

    this.contentType = contentType;
  }

  protected Validator createValidator() throws JspException {
    setValidatorId(FileItemValidator.VALIDATOR_ID);
    FileItemValidator validator = (FileItemValidator) super.createValidator();

    if (maxSize != null) {
      try {
        validator.setMaxSize(Integer.parseInt(maxSize));
      } catch (NumberFormatException e) {
        // ignore
      }
    }
    if (contentType != null) {
      validator.setContentType(contentType);
    }
    return validator;
  }
View Full Code Here

    this.contentType = contentType;
  }

  protected Validator createValidator() throws JspException {
    setValidatorId(FileItemValidator.VALIDATOR_ID);
    FileItemValidator validator = (FileItemValidator) super.createValidator();

    if (maxSize != null) {
      try {
        validator.setMaxSize(Integer.parseInt(maxSize));
      } catch (NumberFormatException e) {
        // ignore
      }
    }
    if (contentType != null) {
      validator.setContentType(StringUtils.split(contentType, ", "));
    }
    return validator;
  }
View Full Code Here

  protected Validator createValidator() throws JspException {

    final FacesContext facesContext = FacesContext.getCurrentInstance();
    final Application application = facesContext.getApplication();
    final FileItemValidator validator = (FileItemValidator) application.createValidator(FileItemValidator.VALIDATOR_ID);
    final ELContext elContext = facesContext.getELContext();

    if (maxSize != null) {
      try {
        validator.setMaxSize((Integer) maxSize.getValue(elContext));
      } catch (final NumberFormatException e) {
        LOG.warn(e.getMessage());
      }
    }
    if (contentType != null) {
      validator.setContentType(ComponentUtils.splitList((String) contentType.getValue(elContext)));
    }
    return validator;
  }
View Full Code Here

  public abstract boolean isContentTypeSet();

  protected Validator createValidator() throws JspException {
    setValidatorId(FileItemValidator.VALIDATOR_ID);
    FileItemValidator validator = (FileItemValidator) super.createValidator();

    if (isMaxSizeSet()) {
      try {
        validator.setMaxSize(Integer.parseInt(getMaxSizeValue()));
      } catch (NumberFormatException e) {
        // ignore
      }
    }
    if (isContentTypeSet()) {
      validator.setContentType(ComponentUtils.splitList(getContentTypeValue()));
    }
    return validator;
  }
View Full Code Here

    this.contentType = contentType;
  }

  protected Validator createValidator() throws JspException {
    setValidatorId(FileItemValidator.VALIDATOR_ID);
    FileItemValidator validator = (FileItemValidator) super.createValidator();

    if (maxSize != null) {
      try {
        validator.setMaxSize(Integer.parseInt(maxSize));
      } catch (NumberFormatException e) {
        // ignore
      }
    }
    if (contentType != null) {
      validator.setContentType(StringUtils.split(contentType, ", "));
    }
    return validator;
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.validator.FileItemValidator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.