Package org.yaac.shared.file

Examples of org.yaac.shared.file.BlobUploadResult


      writeChannel.closeFinally();
     
      logger.info("Uploaded file name : " + fileName + " path : " + file.getFullPath() + " with size = " + rawData.length);
     
      // step 3 : send result back to client
      BlobUploadResult result = AutoBeanUtil.newBlobUploadResult(Status.SUCCESS, fileName, rawData.length);
      resultStr = AutoBeanUtil.encode(BlobUploadResult.class, result);
    } catch (FileUploadException e) {
      logger.log(Level.SEVERE, "failed to save file", e);
     
      BlobUploadResult result = AutoBeanUtil.newBlobUploadResult(Status.FAIL, null, null);
      resultStr = AutoBeanUtil.encode(BlobUploadResult.class, result);
    } catch (IOException e) {
      logger.log(Level.SEVERE, "failed to save file", e);
     
      BlobUploadResult result = AutoBeanUtil.newBlobUploadResult(Status.FAIL, null, null);
      resultStr = AutoBeanUtil.encode(BlobUploadResult.class, result);
    }
   
    // make sure the plain json will be sent back
    resp.setContentType("text/html");
View Full Code Here


   * @param fileName
   * @param size
   * @return
   */
  public static BlobUploadResult newBlobUploadResult(Status status, String fileName, Integer size) {
    BlobUploadResult result = abf.blobUploadResult().as();
    result.setStatus(status);
    result.setFileName(fileName);
    result.setSize(size);
    return result;
  }
View Full Code Here

  void onFormSubmitComplete(SubmitCompleteEvent event) {   
    BlockingAsyncCallback.unblock();
   
    // if event.getResults returns null, then the form is not even submitted
    if (!isNullOrEmpty(event.getResults())) {  // print out result
      BlobUploadResult result = AutoBeanUtil.decode(BlobUploadResult.class, event.getResults());
     
      if (result.getStatus() == Status.SUCCESS) {
        // TODO : i18n
        Window.alert("File " + result.getFileName() + " (size = " + result.getSize() + ") is successfully uploaded");
        form.reset();
        listenr.refreshBlobInfo();
      } else // upload failed
        Window.alert("Can't upload file")// TODO : i18n
      }
View Full Code Here

TOP

Related Classes of org.yaac.shared.file.BlobUploadResult

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.