net.sf.easyweb4j.dispatcher
Class MultiPartParser

java.lang.Object
  extended by net.sf.easyweb4j.dispatcher.MultiPartParser

public class MultiPartParser
extends Object

Parses a multi-part request using Apache Commons FileUpload. It also notifies the controller on the status of parsing, which can be used to display the upload progress using AJAX.

Author:
Chandra Sekar S

Constructor Summary
MultiPartParser(javax.servlet.http.HttpServletRequest request, Controller controller)
          Parses the request and adds the form fields and fileItems.
 
Method Summary
 Map<String,org.apache.commons.fileupload.FileItem[]> getFileItems()
          Retrieves a Map of parameter names of uploaded files to the corresponding FileItem instances.
 Map<String,String[]> getParameters()
          Retrieves a Map of form field parameter names to their corresponding values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiPartParser

public MultiPartParser(javax.servlet.http.HttpServletRequest request,
                       Controller controller)
                throws org.apache.commons.fileupload.FileUploadException,
                       IOException
Parses the request and adds the form fields and fileItems. Also notifies the controller of the progress.

Parameters:
request - The HttpServletRequest to parse.
controller - The Controller instance to notify of progress.
Throws:
org.apache.commons.fileupload.FileUploadException - If parsing of request fails.
IOException - If parsing of request fails.
Method Detail

getParameters

public Map<String,String[]> getParameters()
Retrieves a Map of form field parameter names to their corresponding values.

Returns:
A Map of form field parameter names to their corresponding values.

getFileItems

public Map<String,org.apache.commons.fileupload.FileItem[]> getFileItems()
Retrieves a Map of parameter names of uploaded files to the corresponding FileItem instances.

Returns:
A Map of parameter names of uploaded files to the corresponding FileItem instances.


Copyright © 2009-2010 Chandra Sekar S. All Rights Reserved.