Package org.apache.myfaces.trinidad.model

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


      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

    // This is becasue, the impl of these 2 methods are not complete -
    // Bug - https://issues.apache.org/jira/browse/TRINIDAD-1765
    // This bug could not be fixed due to the explanatio in the bug.

    //call _processFile first. This will create the auto buffer that we want.
    UploadedFile original = _processFile(request, tempFile);
    if(chainedProcessors.isEmpty())
    {
      return original;
    }
    else
View Full Code Here

      final RequestContext   context,
      final ExternalContext  externalContext,
      final UploadedFiles     files,
      final MultipartFormItem item) throws IOException
  {
    final UploadedFile temp = new TempUploadedFile(item);
    Map<String, Object> sessionMap = externalContext.getSessionMap();
    Map<String, Object> requestMap = externalContext.getRequestMap();
   
    _copyParamsFromSessionToRequestMap(sessionMap, requestMap,
      UploadedFileProcessor.MAX_MEMORY_PARAM_NAME,
      UploadedFileProcessor.MAX_DISK_SPACE_PARAM_NAME,
      UploadedFileProcessor.TEMP_DIR_PARAM_NAME,
      UploadedFileProcessor.MAX_FILE_SIZE_PARAM_NAME);
   
    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

    // 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

      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

    // 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 (e.g. does not exist 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)
    {
      // There was a failure while one of the UploadedFileProcessor in the chain processed this file,
      // we expect the details to be in opaqueData
      String errorMessage = file.getOpaqueData().toString();
      FacesMessage fm = MessageFactory.getMessage(context,
                                                  FacesMessage.SEVERITY_WARN,
                                                  "org.apache.myfaces.trinidad.UPLOAD_FAILURE",
                                                  new Object[]{errorMessage}, component);
      throw new ConverterException(fm);
    }

    FacesBean bean = getFacesBean(component);
    Converter converter = getConverter(component, bean);
    // support converter for the <inputFile> component
    if(converter != null)
    {
      // create a unique key (component class name + filename) and use this
      // key to add the actual uploaded file to the requestMap
      String fileNameKey = component.getClass().getName() + "." + file.getFilename();
      context.getExternalContext().getRequestMap().put(fileNameKey, file);

      // applying the above convention. The String here is just the
      // unique key which the converter has to use to look for the
      // actual uploaded file.
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.