Package org.richfaces.model

Examples of org.richfaces.model.UploadItem


    stream.write(getFiles().get((Integer)object).getData());
  }

  }
  public void listener(UploadEvent event) throws IOException{
      UploadItem item = event.getUploadItem();
       File file = new File(); // Caution: NOT a java.io.File

       try{

       file.setName(item.getFileName());
       file.setMime(item.getContentType());

       /*Get File Data*/
       if (item.isTempFile()) {

       byte[] fileInBytes = new byte[(int)item.getFile().length()]; //* TODO: Avoid loss of data in casting 'long' to 'int'
       java.io.File tempFile = item.getFile();
       FileInputStream fileInputStream = new FileInputStream(tempFile);
       fileInputStream.read(fileInBytes);
       fileInputStream.close();

       file.setData(fileInBytes); //

       } else {
       file.setData(item.getData());
       System.out.println("STATUS: "+"Not a temp File!");
       }

       file.setLength(file.getData().length);
       System.out.println("FILE LENGTH: "+file.getData().length/1024+"kb");
View Full Code Here


       
        boolean formUpload = multipartRequest.isFormUpload();
       
        if (isFlash && !formUpload && fileList.size() > 0) {
          try {
            UploadItem item = fileList.get(0);
            int actualSize = item.getFileSize();
            int clientSize = Integer.parseInt(requestParameterMap.get("_richfaces_size"));
           
            if (actualSize != clientSize) {
              return; // File uploading has been stopped on the client side
            }
View Full Code Here

  }
 
  public List<UploadItem> getUploadItems () {
    List <UploadItem> uploadItems = new ArrayList<UploadItem>();
    for (String k : keys) {
      uploadItems.add(new UploadItem(getFileName(k), getFileSize(k), getFileContentType(k), getFile(k)));
    }
    return uploadItems;
  }
View Full Code Here

  public void paint(OutputStream stream, Object object) throws IOException {
    stream.write(getFiles().get((Integer)object).getData());
  }
  public void listener(UploadEvent event) throws Exception{
      UploadItem item = event.getUploadItem();
      File file = new File();
      file.setLength(item.getData().length);
      file.setName(item.getFileName());
      file.setData(item.getData());
      files.add(file);
      uploadsAvailable--;
 
View Full Code Here

  }
 
  public List<UploadItem> getUploadItems () {
    List <UploadItem> uploadItems = new ArrayList<UploadItem>();
    for (String k : keys) {
      uploadItems.add(new UploadItem(getFileName(k), getFileSize(k), getFileContentType(k), getFile(k)));
    }
    return uploadItems;
  }
View Full Code Here

         stream.write(getFiles().get((Integer)object).getData());
      }

  }
  public void listener(UploadEvent event) throws IOException{
      UploadItem item = event.getUploadItem();
      File file = new File();
      file.setLength(item.getData().length);
      file.setName(item.getFileName());
      file.setData(item.getData());
      files.add(file);
      uploadsAvailable--;
  }
View Full Code Here

       
        boolean formUpload = multipartRequest.isFormUpload();
       
        if (isFlash && !formUpload && fileList.size() > 0) {
          try {
            UploadItem item = fileList.get(0);
            int actualSize = item.getFileSize();
            int clientSize = Integer.parseInt(requestParameterMap.get("_richfaces_size"));
           
            if (actualSize != clientSize) {
              return; // File uploading has been stopped on the client side
            }
View Full Code Here

  }
 
  public List<UploadItem> getUploadItems () {
    List <UploadItem> uploadItems = new ArrayList<UploadItem>();
    for (String k : keys) {
      uploadItems.add(new UploadItem(getFileName(k), getFileSize(k), getFileContentType(k), getFile(k)));
    }
    return uploadItems;
  }
View Full Code Here

        log.info("Constructed.");
    }

    public void listener(UploadEvent event) throws Exception {
        log.info("Got: "+event.getUploadItems());
        UploadItem item = event.getUploadItem();
        String filename = FileUploadBean.sanitizeFilename(item.getFileName());
        log.info("File : '" + filename + "' was uploaded");
        URI furi = null;
        if (item.getFile() != null ) {
            File file = item.getFile();
            log.info("Absolute Path : '" + file.getAbsolutePath() + "'!");
            log.info("Adding file to the Data Registry.");
            try {
        furi = dh.storeBytestream(new FileInputStream( file ) , filename );
      } catch (FileNotFoundException e) {
                log.error("File, FileNotFoundException: "+e);
        e.printStackTrace();
      } catch (IOException e) {
                log.error("File, IOException: "+e);
        e.printStackTrace();
      }

        } else if ( item.getData() != null ) {
      furi = dh.storeBytearray(item.getData(), filename );
         
        } else {
          log.error("Upload failed: both Data and File are null!");
          throw new Exception("Upload failed: both Data and File are null!");
        }
View Full Code Here

  }
 
  public List<UploadItem> getUploadItems () {
    List <UploadItem> uploadItems = new ArrayList<UploadItem>();
    for (String k : keys) {
      uploadItems.add(new UploadItem(getFileName(k), getFileSize(k), getFileContentType(k), getFile(k)));
    }
    return uploadItems;
  }
View Full Code Here

TOP

Related Classes of org.richfaces.model.UploadItem

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.