fr.paris.lutece.plugins.form.service.upload
Class FormAsynchronousUploadHandler

java.lang.Object
  extended by fr.paris.lutece.plugins.form.service.upload.FormAsynchronousUploadHandler
All Implemented Interfaces:
fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler

public class FormAsynchronousUploadHandler
extends java.lang.Object
implements fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler

FormAsynchronousUploadHandler.

See Also:
#getFileItem(String, String), #removeFileItem(String, String)

Field Summary
static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<org.apache.commons.fileupload.FileItem>>> _mapAsynchronousUpload
          >
static java.lang.String UPLOAD_CHECKBOX_PREFIX
           
static java.lang.String UPLOAD_DELETE_PREFIX
           
static java.lang.String UPLOAD_SUBMIT_PREFIX
           
 
Constructor Summary
FormAsynchronousUploadHandler()
           
 
Method Summary
 void addFileItemToUploadedFile(org.apache.commons.fileupload.FileItem fileItem, java.lang.String strIdEntry, javax.servlet.http.HttpSession session)
          Add file item to the list of uploaded files
 java.lang.String buildFieldName(java.lang.String strIdEntry)
          Build the field name from a given id entry i.e. : form_1
 void doUploadAction(javax.servlet.http.HttpServletRequest request, java.lang.String strUploadAction)
          Performs an upload action.
 java.util.List<org.apache.commons.fileupload.FileItem> getFileItems(java.lang.String strIdEntry, java.lang.String strSessionId)
          Gets the fileItem for the entry and the given session.
static FormAsynchronousUploadHandler getHandler()
          Get the handler
 java.lang.String getUploadAction(javax.servlet.http.HttpServletRequest request)
          Checks the request parameters to see if an upload submit has been called.
 boolean isInvoked(javax.servlet.http.HttpServletRequest request)
          
 void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.sf.json.JSONObject mainObject, java.util.List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload)
          
 void removeFileItem(java.lang.String strIdEntry, java.lang.String strSessionId, int nIndex)
          Remove file Item
 void removeSessionFiles(java.lang.String strSessionId)
          Removes all files associated to the session
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UPLOAD_SUBMIT_PREFIX

public static final java.lang.String UPLOAD_SUBMIT_PREFIX
See Also:
Constant Field Values

UPLOAD_DELETE_PREFIX

public static final java.lang.String UPLOAD_DELETE_PREFIX
See Also:
Constant Field Values

UPLOAD_CHECKBOX_PREFIX

public static final java.lang.String UPLOAD_CHECKBOX_PREFIX
See Also:
Constant Field Values

_mapAsynchronousUpload

public static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<org.apache.commons.fileupload.FileItem>>> _mapAsynchronousUpload
>

Constructor Detail

FormAsynchronousUploadHandler

public FormAsynchronousUploadHandler()
Method Detail

getHandler

public static FormAsynchronousUploadHandler getHandler()
Get the handler

Returns:
the handler

isInvoked

public boolean isInvoked(javax.servlet.http.HttpServletRequest request)

Specified by:
isInvoked in interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler

process

public void process(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response,
                    net.sf.json.JSONObject mainObject,
                    java.util.List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload)

Specified by:
process in interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler

getFileItems

public java.util.List<org.apache.commons.fileupload.FileItem> getFileItems(java.lang.String strIdEntry,
                                                                           java.lang.String strSessionId)
Gets the fileItem for the entry and the given session.

Parameters:
strIdEntry - the entry
strSessionId - the session id
Returns:
the fileItem found, null otherwise.

removeFileItem

public void removeFileItem(java.lang.String strIdEntry,
                           java.lang.String strSessionId,
                           int nIndex)
Remove file Item

Parameters:
strIdEntry - the id entry
strSessionId - the session id
nIndex - the index

removeSessionFiles

public void removeSessionFiles(java.lang.String strSessionId)
Removes all files associated to the session

Parameters:
strSessionId - the session id

getUploadAction

public java.lang.String getUploadAction(javax.servlet.http.HttpServletRequest request)
Checks the request parameters to see if an upload submit has been called.

Parameters:
request - the HTTP request
Returns:
the name of the upload action, if any. Null otherwise.

doUploadAction

public void doUploadAction(javax.servlet.http.HttpServletRequest request,
                           java.lang.String strUploadAction)
Performs an upload action.

Parameters:
request - the HTTP request
strUploadAction - the name of the upload action

addFileItemToUploadedFile

public void addFileItemToUploadedFile(org.apache.commons.fileupload.FileItem fileItem,
                                      java.lang.String strIdEntry,
                                      javax.servlet.http.HttpSession session)
Add file item to the list of uploaded files

Parameters:
fileItem - the file item
strIdEntry - the id entry
session - the session

buildFieldName

public java.lang.String buildFieldName(java.lang.String strIdEntry)
Build the field name from a given id entry i.e. : form_1

Parameters:
strIdEntry - the id entry
Returns:
the field name


Copyright © 2012 Mairie de Paris. All Rights Reserved.