/**
 * ÀÌ ¼Ò½º´Â Spring ÇÁ·¹ÀÓ¿öÅ© ¿öÅ©ºÏ¿¡¼­ »ç¿ëÇÑ ¿¹Á¦ ¼Ò½ºÀÔ´Ï´Ù. 
 * ÀÌ ¼Ò½º´Â ¸ðµç °³¹ßÀÚµéÀÌ ÀÚÀ¯·Ó°Ô ¼öÁ¤ ¹× ¹èÆ÷ÇÒ ¼ö ÀÖ½À´Ï´Ù. 
 * ´Ü, ÀÌ ¼Ò½º¸¦ ±â¹ÝÀ¸·Î »õ·Î¿î ¾ÖÇÃ¸®ÄÉÀÌ¼ÇÀ» °³¹ßÇÒ °æ¿ì ÃâÃ³¸¦ ¸í½ÃÇØ ÁÖ½Ã¸é µË´Ï´Ù. 
 */
package net.javajigi.common.upload;

import java.util.Hashtable;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

/**
 * ÁÖ¼®À» ³Ö¾î ÁÖ¼¼¿ä. ¹è°¡ °íÆÄ¿ä.
 * 
 * @author ¹ÚÀç¼º(ÀÚ¹ÙÁö±â, javajigi@gmail.com)
 */
public interface MultipartRequestHandler {
    /**
     * After constructed, this is the first method called on
     * by ActionServlet.  Use this method for all your
     * data-parsing of the ServletInputStream in the request
     *
     * @exception ServletException thrown if something goes wrong
     */
   public void handleRequest(HttpServletRequest request)
       throws ServletException;

   /**
    * This method is called on to retrieve all the text
    * input elements of the request.
    *
    * @return A Hashtable where the keys and values are the names and
    *  values of the request input parameters
    */
   public Hashtable getTextElements();
   
   /**
    * This method is called on to retrieve all the FormFile
    * input elements of the request.
    * @see org.apache.struts.upload.FormFile
    * @return A Hashtable where the keys are the input names of the
    *  files and the values are FormFile objects
    */
   public Hashtable getFileElements();

   /**
    * This method returns all elements of a multipart request.
    * @return A Hashtable where the keys are input names and values
    *   are either Strings or FormFiles
    */
   public Hashtable getAllElements();

   /**
    * This method is called on when there's some sort of problem
    * and the form post needs to be rolled back.  Providers
    * should remove any FormFiles used to hold information
    * by setting them to null and also physically delete
    * them if the implementation calls for writing directly
    * to disk.
    * NOTE: Currently implemented but not automatically
    * supported, ActionForm implementors must call rollback()
    * manually for rolling back file uploads.
    */
   public void rollback();

   /**
    * This method is called on when a successful form post
    * has been made.  Some implementations will use this
    * to destroy temporary files or write to a database
    * or something of that nature.
    */
   public void finish();
}
