Package hudson.util

Class MultipartFormDataParser

  • All Implemented Interfaces:
    AutoCloseable

    public class MultipartFormDataParser
    extends Object
    implements AutoCloseable
    Wraps commons file-upload and handles a "multipart/form-data" form submission (that often includes file upload.)
    Author:
    Kohsuke Kawaguchi
    • Constructor Detail

      • MultipartFormDataParser

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public MultipartFormDataParser​(javax.servlet.http.HttpServletRequest request,
                                       int maxParts,
                                       long maxPartSize,
                                       long maxSize)
                                throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
      • MultipartFormDataParser

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public MultipartFormDataParser​(javax.servlet.http.HttpServletRequest request,
                                       int maxParts)
                                throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
      • MultipartFormDataParser

        public MultipartFormDataParser​(javax.servlet.http.HttpServletRequest request)
                                throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
    • Method Detail

      • getFileItem

        public org.apache.commons.fileupload.FileItem getFileItem​(String key)
      • cleanUp

        public void cleanUp()
        If any file is created on the disk, delete them all. Even if this method is not called, the resource will be still cleaned up later by GC.
      • isMultiPartForm

        public static boolean isMultiPartForm​(@CheckForNull
                                              String contentType)
        Checks a Content-Type string to assert if it is "multipart/form-data".
        Parameters:
        contentType - Content-Type string.
        Returns:
        true if the content type is "multipart/form-data", otherwise false.
        Since:
        1.620