org.cafesip.gwtcomp.server
Interface FileUploadAction


public interface FileUploadAction

Interface that an action class must implement for working with the FileUploadServlet servlet. Once registered with the FileUploadServlet (using init params), the action methods will be invoked by the servlet when a file upload request is received from the client. For details see the, FileUploadServlet class.

The class implementing this method can also include addition parameter fields with public getter and setter methods. The FileUploadServlet will automatically populate these parameters if the name of the parameter is the same as the name of the HTML input fields on the client-side. Therefore, you can create a client-side HTML form with one or more input field (text field, password, hidden, etc.) and one or more file upload fields. When the servlet invokes the onSubmit() method (see below), it already has the input fields populated and the upload file list is set (using the setFileList() method, below). In the onSubmit() method (see below), you can add your business logic to implement what your application needs to do to handle the form. It is similar to a JSF bean class in concept.

Examples:


Method Summary
 FormResponse onSubmit(javax.servlet.http.HttpServlet servlet, javax.servlet.http.HttpServletRequest request)
          The FileUpload servlet invokes this method to notify that a client-side request is received.
 void setFileList(java.util.HashMap<java.lang.String,java.io.File> files)
          The FileUpload servlet invokes this method to set a list of files that is being uploaded.
 

Method Detail

setFileList

void setFileList(java.util.HashMap<java.lang.String,java.io.File> files)
The FileUpload servlet invokes this method to set a list of files that is being uploaded. You can implement this method to receive the list of files.

Parameters:
files - list of files. The key property for the HashMap contains the field name specified in the HTML form and the value contains the file path name of the file that the FileUploadServlet copied the file into.

onSubmit

FormResponse onSubmit(javax.servlet.http.HttpServlet servlet,
                      javax.servlet.http.HttpServletRequest request)
The FileUpload servlet invokes this method to notify that a client-side request is received. You can implement this method to handle the event. The method returns a FormResponse object to tell the servlet how to (HTTP) respond to the form request.

Parameters:
servlet - the servlet that handled the request.
request - the request context. Both of these parameters can be used to get servlet-specific information like session-scope variables, etc. using the standard servlet API.
Returns:
the FormResponse object


http://www.cafesip.org