Package org.apache.myfaces.trinidad.model

Examples of org.apache.myfaces.trinidad.model.UploadedFile


    // Since we override getSubmittedValue() entirely,
    // detect auto submit manually
    detectAutoSubmit(context, component, clientId);

    Object result = null;
    UploadedFile file = null;

    UploadedFiles files = UploadedFiles.getUploadedFiles(context);
    if (files != null)
    {
      file = files.getUploadedFile(clientId);
    }

    // If we couldn't find a file (or the file is empty), return "FALSE" to indicate that
    // the file upload *was* available, but didn't upload a file
    // this time.
    if (file == null || file.getLength() == 0)
      result = Boolean.FALSE;
    else
      result = file;

    return result;
View Full Code Here


  {
    // Convert FALSE back into null
    if (submittedValue == Boolean.FALSE)
      return null;

    UploadedFile file = (UploadedFile) submittedValue;
    if(file.getLength() == -1)
    {
      FacesMessage fm = MessageFactory.getMessage(context, "org.apache.myfaces.trinidad.UPLOAD");
      throw new ConverterException(fm);
    }
    return submittedValue;
View Full Code Here

    _panelPage = panelPage;
  }

  public void fileUploaded(ValueChangeEvent event)
  {
    UploadedFile file = (UploadedFile) event.getNewValue();
    if (file != null)
    {
      FacesContext context = FacesContext.getCurrentInstance();
      FacesMessage message = new FacesMessage(
         "Uploaded file " + file.getFilename() +
         " (" + file.getLength() + " bytes)");
      context.addMessage(event.getComponent().getClientId(context), message);
    }
  }
View Full Code Here

   * @param name the name under which the file is stored.  In HTML forms,
   *   this will be derived from the "name" set on the <input> tag.
   */
  public UploadedFile getUploadedFile(String name)
  {
    UploadedFile file = _map.get(name);
    if (file == null)
      return null;

    return new FixFilename(file, _characterEncoding);
  }
View Full Code Here

  public void dispose()
  {
    Iterator<UploadedFile> iterator = _map.values().iterator();
    while (iterator.hasNext())
    {
      UploadedFile file = iterator.next();
      file.dispose();
    }

    _map.clear();

    _totalMemory    = 0;
View Full Code Here

      final RequestContext   context,
      final ExternalContext  externalContext,
      final UploadedFiles     files,
      final MultipartFormItem item) throws IOException
  {
    final UploadedFile temp = new TempUploadedFile(item);

    final UploadedFile file =
      context.getUploadedFileProcessor().processFile(externalContext.getRequest(), temp);

    if (file != null)
    {
      // Store the file.
      files.__put(item.getName(), file);

      if (_LOG.isFine())
      {
        _LOG.fine("Uploaded file " + file.getFilename() + "(" +
            file.getLength() + " bytes) for ID " + item.getName());
      }
    }
  }
View Full Code Here

      final RequestContext   context,
      final ExternalContext  externalContext,
      final UploadedFiles     files,
      final MultipartFormItem item) throws IOException
  {
    final UploadedFile temp = new TempUploadedFile(item);

    final UploadedFile file =
      context.getUploadedFileProcessor().processFile(externalContext.getRequest(), temp);

    if (file != null)
    {
      // Store the file.
      files.__put(item.getName(), file);

      if (_LOG.isFine())
      {
        _LOG.fine("Uploaded file " + file.getFilename() + "(" +
            file.getLength() + " bytes) for ID " + item.getName());
      }
    }
  }
View Full Code Here

      final RequestContext   context,
      final ExternalContext  externalContext,
      final UploadedFiles     files,
      final MultipartFormItem item) throws IOException
  {
    final UploadedFile temp = new TempUploadedFile(item);

    final UploadedFile file =
      context.getUploadedFileProcessor().processFile(externalContext.getRequest(), temp);

    if (file != null)
    {
      // Store the file.
      files.__put(item.getName(), file);

      if (_LOG.isFine())
      {
        _LOG.fine("Uploaded file " + file.getFilename() + "(" +
            file.getLength() + " bytes) for ID " + item.getName());
      }
    }
  }
View Full Code Here

      final RequestContext   context,
      final ExternalContext  externalContext,
      final UploadedFiles     files,
      final MultipartFormItem item) throws IOException
  {
    final UploadedFile temp = new TempUploadedFile(item);

    final UploadedFile file =
      context.getUploadedFileProcessor().processFile(externalContext.getRequest(), temp);

    if (file != null)
    {
      // Store the file.
      files.__put(item.getName(), file);

      if (_LOG.isFine())
      {
        _LOG.fine("Uploaded file " + file.getFilename() + "(" +
            file.getLength() + " bytes) for ID " + item.getName());
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.model.UploadedFile

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.