org.springframework.mock.web

Class MockMultipartHttpServletRequest

    • Method Detail

      • addFile

        public void addFile(MultipartFile file)
        Add a file to this request. The parameter name from the multipart form is taken from the MultipartFile.getName().
        Parameters:
        file - multipart file to be added
      • getFileNames

        public java.util.Iterator<java.lang.String> getFileNames()
        Description copied from interface: MultipartRequest
        Return an Iterator of String objects containing the parameter names of the multipart files contained in this request. These are the field names of the form (like with normal parameters), not the original file names.
        Specified by:
        getFileNames in interface MultipartRequest
        Returns:
        the names of the files
      • getFile

        public MultipartFile getFile(java.lang.String name)
        Description copied from interface: MultipartRequest
        Return the contents plus description of an uploaded file in this request, or null if it does not exist.
        Specified by:
        getFile in interface MultipartRequest
        Parameters:
        name - a String specifying the parameter name of the multipart file
        Returns:
        the uploaded content in the form of a MultipartFile object
      • getFiles

        public java.util.List<MultipartFile> getFiles(java.lang.String name)
        Description copied from interface: MultipartRequest
        Return the contents plus description of uploaded files in this request, or an empty list if it does not exist.
        Specified by:
        getFiles in interface MultipartRequest
        Parameters:
        name - a String specifying the parameter name of the multipart file
        Returns:
        the uploaded content in the form of a MultipartFile list
      • getFileMap

        public java.util.Map<java.lang.String,MultipartFile> getFileMap()
        Description copied from interface: MultipartRequest
        Return a Map of the multipart files contained in this request.
        Specified by:
        getFileMap in interface MultipartRequest
        Returns:
        a map containing the parameter names as keys, and the MultipartFile objects as values
      • getMultipartContentType

        public java.lang.String getMultipartContentType(java.lang.String paramOrFileName)
        Description copied from interface: MultipartRequest
        Determine the content type of the specified request part.
        Specified by:
        getMultipartContentType in interface MultipartRequest
        Parameters:
        paramOrFileName - the name of the part
        Returns:
        the associated content type, or null if not defined
      • getMultipartHeaders

        public HttpHeaders getMultipartHeaders(java.lang.String paramOrFileName)
        Description copied from interface: MultipartHttpServletRequest
        Return the headers associated with the specified part of the multipart request.

        If the underlying implementation supports access to headers, then all headers are returned. Otherwise, the returned headers will include a 'Content-Type' header at the very least.

        Specified by:
        getMultipartHeaders in interface MultipartHttpServletRequest