Class MultipartServletWebRequestImpl

    • Constructor Detail

      • MultipartServletWebRequestImpl

        public MultipartServletWebRequestImpl​(javax.servlet.http.HttpServletRequest request,
                                              String filterPrefix,
                                              Bytes maxSize,
                                              String upload)
                                       throws org.apache.commons.fileupload.FileUploadException
        Constructor. This constructor will use DiskFileItemFactory to store uploads.
        Parameters:
        request - the servlet request
        filterPrefix - prefix to wicket filter mapping
        maxSize - the maximum size allowed for this request
        upload - upload identifier for UploadInfo
        Throws:
        org.apache.commons.fileupload.FileUploadException - Thrown if something goes wrong with upload
      • MultipartServletWebRequestImpl

        public MultipartServletWebRequestImpl​(javax.servlet.http.HttpServletRequest request,
                                              String filterPrefix,
                                              Bytes maxSize,
                                              String upload,
                                              org.apache.commons.fileupload.FileItemFactory factory)
                                       throws org.apache.commons.fileupload.FileUploadException
        Constructor
        Parameters:
        request - the servlet request
        filterPrefix - prefix to wicket filter mapping
        maxSize - the maximum size allowed for this request
        upload - upload identifier for UploadInfo
        factory - DiskFileItemFactory to use when creating file items used to represent uploaded files
        Throws:
        org.apache.commons.fileupload.FileUploadException - Thrown if something goes wrong with upload
    • Method Detail

      • newFileUpload

        protected org.apache.commons.fileupload.FileUploadBase newFileUpload​(String encoding)
        Factory method for creating new instances of FileUploadBase
        Parameters:
        encoding - The encoding to use while reading the data
        Returns:
        A new instance of FileUploadBase
      • getFiles

        public Map<String,​List<org.apache.commons.fileupload.FileItem>> getFiles()
        Returns:
        Returns the files.
      • getFile

        public List<org.apache.commons.fileupload.FileItem> getFile​(String fieldName)
        Gets the file that was uploaded using the given field name.
        Parameters:
        fieldName - the field name that was used for the upload
        Returns:
        the upload with the given field name
      • onUploadStarted

        protected void onUploadStarted​(int totalBytes)
        Upload start callback
        Parameters:
        totalBytes -
      • onUploadUpdate

        protected void onUploadUpdate​(int bytesUploaded,
                                      int total)
        Upload status update callback
        Parameters:
        bytesUploaded -
        total -
      • getUploadInfo

        public static UploadInfo getUploadInfo​(javax.servlet.http.HttpServletRequest req,
                                               String upload)
        Retrieves UploadInfo from session, null if not found.
        Parameters:
        req - http servlet request, not null
        upload - upload identifier
        Returns:
        UploadInfo object from session, or null if not found
      • setUploadInfo

        public static void setUploadInfo​(javax.servlet.http.HttpServletRequest req,
                                         String upload,
                                         UploadInfo uploadInfo)
        Sets the UploadInfo object into session.
        Parameters:
        req - http servlet request, not null
        upload - upload identifier
        uploadInfo - UploadInfo object to be put into session, not null
      • clearUploadInfo

        public static void clearUploadInfo​(javax.servlet.http.HttpServletRequest req,
                                           String upload)
        Clears the UploadInfo object from session if one exists.
        Parameters:
        req - http servlet request, not null
        upload - upload identifier