/*
 * 
 * Created on Aug 2, 2005
 * 
 * György Süveges
 * Etixpert Kft.
 * Copyright(c) 2005
 * 
 */
package com.etixpert.evolution.gui.servlets.pageactions;

import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.apache.commons.fileupload.*;

import java.util.*;

/**
 * @author Suveges Gyorgy
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public abstract class MultipartPageActionHandler extends PageActionHandler {
    protected List fileItems;
    /**
     * 
     */
    public MultipartPageActionHandler() {
        super();
        
    }

    public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException {
        HttpSession session = request.getSession();
        fileItems = (List) session.getAttribute("uploaded");
        session.removeAttribute("uploaded");
        super.handleRequest(request, response);
      
    }
    
    protected void deleteItems() {
        for (int i=0; i<fileItems.size(); i++) {
            FileItem item = (FileItem) fileItems.get(i);
            item.delete();
            
            
        }
        
            
    }

}
