Package hudson.util
Class MultipartFormDataParser
- java.lang.Object
-
- hudson.util.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 Summary
Constructors Constructor Description MultipartFormDataParser(javax.servlet.http.HttpServletRequest request)MultipartFormDataParser(javax.servlet.http.HttpServletRequest request, int maxParts)MultipartFormDataParser(javax.servlet.http.HttpServletRequest request, int maxParts, long maxPartSize, long maxSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanUp()If any file is created on the disk, delete them all.voidclose()Alias forcleanUp().Stringget(String key)org.apache.commons.fileupload.FileItemgetFileItem(String key)static booleanisMultiPartForm(String contentType)Checks a Content-Type string to assert if it is "multipart/form-data".
-
-
-
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.
-
close
public void close()
Alias forcleanUp().- Specified by:
closein interfaceAutoCloseable
-
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:
trueif the content type is "multipart/form-data", otherwisefalse.- Since:
- 1.620
-
-