Package org.richfaces.model

Examples of org.richfaces.model.UploadItem


       
        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


   * @throws IOException
   *             Signals that an I/O exception has occurred.
   */
  public void listener( UploadEvent event ) throws IOException
  {
    UploadItem item = event.getUploadItem();
    System.out.println( "FileUploadBean.listener()" );

    // Store the file info
    FileInfo fileInfo = new FileInfo();
    fileInfo.setName( item.getFileName() );
    fileInfo.setLength( item.getFileSize() );
    fileInfo.setData( item.getData() );
    files.add( fileInfo );

    // Write the file to disk
    try
    {
      File inputFile = item.getFile();
      File outputFile = new File( Settings.GRAPHS_PATH + item.getFileName() );
      FileReader in = new FileReader( inputFile );
      FileWriter out = new FileWriter( outputFile );
      int c;
      while( ( c = in.read() ) != -1 )
        out.write( c );
View Full Code Here

   *            the event
   */
  public void listener( UploadEvent event )
  {

    UploadItem item = event.getUploadItem();
    Logger.write( "File : '" + item.getFileName() + "' was uploaded" );
    // if (item.isTempFile()) {
    // String file = item.getFileName();

    // logger.write("Absolute Path : '" + file + "'!");
    // file.delete();
    // }else {

    // uniqueName = UUID.randomUUID().toString();
    UploadItem ui = null;
    try
    {

      ui = (UploadItem)data.get( data.size() - 1 );
      Logger.write( "filename is: " + ui.getFileName() );
      Logger.write( "file size is: " + ui.getFileSize() );
      Logger.write( "the uploaded file is: " + ui.getFile() );
    }
    catch( Exception e )
    {
      Logger.write( "problem with file upload: " );
      e.printStackTrace();
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

     
      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 synchronized void paint(OutputStream stream, Object object) throws IOException {
    stream.write(getFiles().get((Integer)object).getData());
  }
  public synchronized 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 synchronized void paint(OutputStream stream, Object object) throws IOException {
    stream.write(getFiles().get((Integer)object).getData());
  }
  public synchronized 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

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.