Package org.apache.commons.io

Examples of org.apache.commons.io.FileCleaningTracker


  {
    DiskFileItemFactory factory = new DiskFileItemFactory();
    factory.setSizeThreshold(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD);
    factory.setRepository(repository);

    FileCleaningTracker pTracker = FileCleanerCleanup.getFileCleaningTracker(context);
    factory.setFileCleaningTracker(pTracker);

    return factory;
  }
View Full Code Here


     */
    public FileItem createItem(String fieldName, String contentType,
            boolean isFormField, String fileName) {
        DiskFileItem result = new DiskFileItem(fieldName, contentType,
                isFormField, fileName, sizeThreshold, repository);
        FileCleaningTracker tracker = getFileCleaningTracker();
        if (tracker != null) {
            tracker.track(result.getTempFile(), result);
        }
        return result;
    }
View Full Code Here

     * @param sce The servlet context, used for calling
     *   {@link #setFileCleaningTracker(ServletContext, FileCleaningTracker)}.
     */
    public void contextInitialized(ServletContextEvent sce) {
        setFileCleaningTracker(sce.getServletContext(),
                new FileCleaningTracker());
    }
View Full Code Here

  /**
   * Construct.
   */
  public FileCleaner()
  {
    cleaner = new FileCleaningTracker();
  }
View Full Code Here

  {
    DiskFileItemFactory factory = new DiskFileItemFactory();
    factory.setSizeThreshold(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD);
    factory.setRepository(repository);

    FileCleaningTracker pTracker = FileCleanerCleanup.getFileCleaningTracker(context);
    factory.setFileCleaningTracker(pTracker);

    return factory;
  }
View Full Code Here

     * @param sce The servlet context, used for calling
     *   {@link #setFileCleaningTracker(ServletContext, FileCleaningTracker)}.
     */
    public void contextInitialized(ServletContextEvent sce) {
        setFileCleaningTracker(sce.getServletContext(),
                new FileCleaningTracker());
    }
View Full Code Here

     */
    public FileItem createItem(String fieldName, String contentType,
            boolean isFormField, String fileName) {
        DiskFileItem result = new DiskFileItem(fieldName, contentType,
                isFormField, fileName, sizeThreshold, repository);
        FileCleaningTracker tracker = getFileCleaningTracker();
        if (tracker != null) {
            tracker.track(result.getTempFile(), this);
        }
        return result;
    }
View Full Code Here

      }
      if(uploadDir != null) {
        diskFileItemFactory.setRepository(new File(uploadDir));
      }

            FileCleaningTracker fileCleaningTracker = FileCleanerCleanup.getFileCleaningTracker(httpServletRequest.getSession().getServletContext());
            if(fileCleaningTracker != null) {
                diskFileItemFactory.setFileCleaningTracker(fileCleaningTracker);
            }

      ServletFileUpload servletFileUpload = new ServletFileUpload(diskFileItemFactory);
View Full Code Here

   
    progressTracker = ProgressTrackerSingleton.getSingleton();
  }

  public void destroy() {
    FileCleaningTracker cleaner = FileCleanerCleanup.getFileCleaningTracker(this.getServletContext());
    if( null != cleaner ) {
      cleaner.exitWhenFinished();
    }
  }
View Full Code Here

                return progress.isCanceled();
            }
        };
       
        DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
        fileItemFactory.setFileCleaningTracker(new FileCleaningTracker());
       
        ServletFileUpload upload = new ServletFileUpload(fileItemFactory);
        upload.setProgressListener(new ProgressListener() {
            boolean setContentLength = false;
            long lastBytesRead = 0;
View Full Code Here

TOP

Related Classes of org.apache.commons.io.FileCleaningTracker

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.