Examples of UploadedFile


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

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

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

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

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

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

   * @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

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

  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

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

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

Examples of org.apache.tapestry.upload.services.UploadedFile

    @Test
    public void process_submission_ignores_null_value() throws Exception
    {
        FormSupport formSupport = mockFormSupport();
        MultipartDecoder decoder = mockMultipartDecoder();
        UploadedFile uploadedFile = mockUploadedFile();

        Upload component = new Upload(null, null, decoder, null);

        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
        expect(uploadedFile.getFileName()).andReturn("").atLeastOnce();

        replay();

        component.processSubmission(formSupport, "test");
View Full Code Here

Examples of org.apache.tapestry.upload.services.UploadedFile

    @Test
    public void process_submission_calls_validator() throws Exception
    {
        FormSupport formSupport = mockFormSupport();
        MultipartDecoder decoder = mockMultipartDecoder();
        UploadedFile uploadedFile = mockUploadedFile();
        FieldValidator<Object> validate = mockFieldValidator();

        Upload component = new Upload(null, validate, decoder, null);

        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
        expect(uploadedFile.getFileName()).andReturn("test").atLeastOnce();
        validate.validate(uploadedFile);
        replay();

        component.processSubmission(formSupport, "test");
View Full Code Here

Examples of org.apache.tapestry.upload.services.UploadedFile

    @Test
    public void process_submission_tracks_validator_errors() throws Exception
    {
        FormSupport formSupport = mockFormSupport();
        MultipartDecoder decoder = mockMultipartDecoder();
        UploadedFile uploadedFile = mockUploadedFile();
        FieldValidator<Object> validate = mockFieldValidator();
        ValidationTracker tracker = mockValidationTracker();

        Upload component = new Upload(null, validate, decoder, tracker);

        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
        expect(uploadedFile.getFileName()).andReturn("test").atLeastOnce();
        validate.validate(uploadedFile);
        expectLastCall().andThrow(new ValidationException("an error"));
        tracker.recordError(component, "an error");
        replay();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.