Package org.apache.wicket.markup.html.form.upload

Examples of org.apache.wicket.markup.html.form.upload.FileUpload


    assertNotNull(domainObject);
    assertNotNull(domainObject.getText());
    assertEquals("Mock value", domainObject.getText());

    FileUpload fileUpload = page.getFileUpload();
    assertNotNull(fileUpload);

    assertTrue("uploaded content does not have the right size, expected 428, got " +
      fileUpload.getBytes().length, fileUpload.getBytes().length == 428);
    assertEquals("bg.jpg", fileUpload.getClientFileName());
    assertEquals("image/jpeg", fileUpload.getContentType());
  }
View Full Code Here


    }

    @Override
    public void onSubmit()
    {
      final FileUpload upload = fileUploadField.getFileUpload();
      if (upload != null)
      {
        try
        {
          String fileName = upload.getClientFileName();
          if (resourceService.validateFormat(fileName, formats))
          {
            Resource resource = resourceService
                .newResourceFromFileName(upload
                    .getClientFileName());
            resourceService.upload(upload.getInputStream(),
                resource);

            fileUploadContext.setUploadedResource(resource);
            fileUploadContext.setSuccess(true);
View Full Code Here

      @Override
      public void onSubmit()
      {

        final FileUpload upload = fileUploadField.getFileUpload();

        if (upload != null)
        {

          Image img = new Image();
          img.setData(upload.getBytes());
          img.setType(upload.getContentType());

          imageService.save(img);
          publicite.setImage(img);

        }
View Full Code Here

      @Override
      public void onSubmit()
      {

        final FileUpload upload = fileUploadField.getFileUpload();

        if (upload != null)
        {

          Image img = new Image();
          img.setData(upload.getBytes());
          img.setType(upload.getContentType());

          imageService.save(img);
          choix.setImage(img);
        }
View Full Code Here

      @Override
      protected void onSubmit()
      {
        // display uploaded info
        info("Text: " + text.getModelObject());
        FileUpload upload = file.getFileUpload();
        if (upload == null)
        {
          info("No file uploaded");
        }
        else
        {
          info("File-Name: " + upload.getClientFileName() + " File-Size: " +
            Bytes.bytes(upload.getSize()).toString());
        }
      }
    };
    form.setMaxSize(Bytes.megabytes(1));
    add(form);
View Full Code Here

    assertNotNull(domainObject);
    assertNotNull(domainObject.getText());
    assertEquals("Mock value", domainObject.getText());

    FileUpload fileUpload = page.getFileUpload();
    assertNotNull(fileUpload);

    assertTrue("setFile failed, no upload content detected.", fileUpload.getBytes().length > 0);
    assertEquals("pom.xml", fileUpload.getClientFileName());
    assertEquals("text/xml", fileUpload.getContentType());
  }
View Full Code Here

    assertNotNull(domainObject);
    assertNotNull(domainObject.getText());
    assertEquals("Mock value", domainObject.getText());

    FileUpload fileUpload = page.getFileUpload();
    assertNotNull(fileUpload);

    assertTrue(
      "uploaded content does not have the right size, expected 428, got " +
        fileUpload.getBytes().length, fileUpload.getBytes().length == 428);
    assertEquals("bg.jpg", fileUpload.getClientFileName());
    assertEquals("image/jpeg", fileUpload.getContentType());
  }
View Full Code Here

        sendJsResponse(target, ErrorCodes.FILE_SIZE_LIMIT.name());
      }

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
        FileUpload upload = scriptFile.getFileUpload();
        if (upload == null) {
          return;
        }
        executeImport(target, importOptions, upload);
      }
View Full Code Here

      Form form = new Form("form"){
        @Override
        protected void onSubmit() {
          super.onSubmit();
          
          FileUpload fileUpload = fileUploadField.getFileUpload();
         
            try {
              File file = new File(System.getProperty("java.io.tmpdir") + "/" +
                fileUpload.getClientFileName());
           
              fileUpload.writeTo(file);
            } catch (IOException e) {
         e.printStackTrace();
       }
        }
      }
View Full Code Here

    assertNotNull(domainObject);
    assertNotNull(domainObject.getText());
    assertEquals("Mock value", domainObject.getText());

    FileUpload fileUpload = page.getFileUpload();
    assertNotNull(fileUpload);

    assertTrue("setFile failed, no upload content detected.", fileUpload.getBytes().length > 0);
    assertEquals("pom.xml", fileUpload.getClientFileName());
    assertEquals("text/xml", fileUpload.getContentType());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.form.upload.FileUpload

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.