Package org.eclipse.jetty.http
Class MultiPartFormInputStream
- java.lang.Object
-
- org.eclipse.jetty.http.MultiPartFormInputStream
-
public class MultiPartFormInputStream extends java.lang.ObjectMultiPartInputStreamHandle a MultiPart Mime input stream, breaking it up on the boundary into files and strings.
- See Also:
- https://tools.ietf.org/html/rfc7578
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classMultiPartFormInputStream.HandlerclassMultiPartFormInputStream.MultiPartstatic classMultiPartFormInputStream.NonCompliance
-
Field Summary
Fields Modifier and Type Field Description private int_bufferSizeprivate javax.servlet.MultipartConfigElement_configprivate java.lang.String_contentTypeprivate java.io.File_contextTmpDirprivate java.lang.Throwable_errprivate java.io.InputStream_inprivate int_maxPartsprivate java.util.EnumSet<MultiPartFormInputStream.NonCompliance>_nonComplianceWarningsprivate int_numPartsprivate boolean_parsedprivate MultiMap<javax.servlet.http.Part>_partsprivate java.io.File_tmpDirprivate boolean_writeFilesWithFilenamesprivate static intDEFAULT_MAX_FORM_KEYSprivate static MultiMap<javax.servlet.http.Part>EMPTY_MAPprivate static LoggerLOG
-
Constructor Summary
Constructors Constructor Description MultiPartFormInputStream(java.io.InputStream in, java.lang.String contentType, javax.servlet.MultipartConfigElement config, java.io.File contextTmpDir)MultiPartFormInputStream(java.io.InputStream in, java.lang.String contentType, javax.servlet.MultipartConfigElement config, java.io.File contextTmpDir, int maxParts)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddeleteParts()Delete any tmp storage for parts, and clear out the parts list.private static java.lang.StringfilenameValue(java.lang.String nameEqualsValue)intgetBufferSize()java.util.EnumSet<MultiPartFormInputStream.NonCompliance>getNonComplianceWarnings()java.util.Collection<javax.servlet.http.Part>getParsedParts()Deprecated.javax.servlet.http.PartgetPart(java.lang.String name)Get the named Part.java.util.Collection<javax.servlet.http.Part>getParts()Parse, if necessary, the multipart data and return the list of Parts.booleanisDeleteOnExit()Deprecated.no replacement providedbooleanisEmpty()booleanisWriteFilesWithFilenames()protected voidparse()Parse, if necessary, the multipart stream.voidsetBufferSize(int bufferSize)voidsetDeleteOnExit(boolean deleteOnExit)Deprecated.no replacement provided.voidsetWriteFilesWithFilenames(boolean writeFilesWithFilenames)protected voidthrowIfError()Throws an exception if one has been latched.private static java.lang.Stringvalue(java.lang.String nameEqualsValue)
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
DEFAULT_MAX_FORM_KEYS
private static final int DEFAULT_MAX_FORM_KEYS
- See Also:
- Constant Field Values
-
EMPTY_MAP
private static final MultiMap<javax.servlet.http.Part> EMPTY_MAP
-
_nonComplianceWarnings
private final java.util.EnumSet<MultiPartFormInputStream.NonCompliance> _nonComplianceWarnings
-
_parts
private final MultiMap<javax.servlet.http.Part> _parts
-
_maxParts
private final int _maxParts
-
_numParts
private int _numParts
-
_in
private java.io.InputStream _in
-
_config
private javax.servlet.MultipartConfigElement _config
-
_contentType
private java.lang.String _contentType
-
_err
private java.lang.Throwable _err
-
_tmpDir
private java.io.File _tmpDir
-
_contextTmpDir
private java.io.File _contextTmpDir
-
_writeFilesWithFilenames
private boolean _writeFilesWithFilenames
-
_parsed
private boolean _parsed
-
_bufferSize
private int _bufferSize
-
-
Constructor Detail
-
MultiPartFormInputStream
public MultiPartFormInputStream(java.io.InputStream in, java.lang.String contentType, javax.servlet.MultipartConfigElement config, java.io.File contextTmpDir)- Parameters:
in- Request input streamcontentType- Content-Type headerconfig- MultipartConfigElementcontextTmpDir- javax.servlet.context.tempdir
-
MultiPartFormInputStream
public MultiPartFormInputStream(java.io.InputStream in, java.lang.String contentType, javax.servlet.MultipartConfigElement config, java.io.File contextTmpDir, int maxParts)- Parameters:
in- Request input streamcontentType- Content-Type headerconfig- MultipartConfigElementcontextTmpDir- javax.servlet.context.tempdirmaxParts- the maximum number of parts that can be parsed from the multipart content (0 for no parts allowed, -1 for unlimited parts).
-
-
Method Detail
-
getNonComplianceWarnings
public java.util.EnumSet<MultiPartFormInputStream.NonCompliance> getNonComplianceWarnings()
- Returns:
- an EnumSet of non compliances with the RFC that were accepted by this parser
-
isEmpty
public boolean isEmpty()
- Returns:
- whether the list of parsed parts is empty
-
getParsedParts
@Deprecated public java.util.Collection<javax.servlet.http.Part> getParsedParts()
Deprecated.Get the already parsed parts.- Returns:
- the parts that were parsed
-
deleteParts
public void deleteParts()
Delete any tmp storage for parts, and clear out the parts list.
-
getParts
public java.util.Collection<javax.servlet.http.Part> getParts() throws java.io.IOExceptionParse, if necessary, the multipart data and return the list of Parts.- Returns:
- the parts
- Throws:
java.io.IOException- if unable to get the parts
-
getPart
public javax.servlet.http.Part getPart(java.lang.String name) throws java.io.IOExceptionGet the named Part.- Parameters:
name- the part name- Returns:
- the parts
- Throws:
java.io.IOException- if unable to get the part
-
throwIfError
protected void throwIfError() throws java.io.IOExceptionThrows an exception if one has been latched.- Throws:
java.io.IOException- the exception (if present)
-
parse
protected void parse()
Parse, if necessary, the multipart stream.
-
setDeleteOnExit
@Deprecated public void setDeleteOnExit(boolean deleteOnExit)
Deprecated.no replacement provided.
-
setWriteFilesWithFilenames
public void setWriteFilesWithFilenames(boolean writeFilesWithFilenames)
-
isWriteFilesWithFilenames
public boolean isWriteFilesWithFilenames()
-
isDeleteOnExit
@Deprecated public boolean isDeleteOnExit()
Deprecated.no replacement provided
-
value
private static java.lang.String value(java.lang.String nameEqualsValue)
-
filenameValue
private static java.lang.String filenameValue(java.lang.String nameEqualsValue)
-
getBufferSize
public int getBufferSize()
- Returns:
- the size of buffer used to read data from the input stream
-
setBufferSize
public void setBufferSize(int bufferSize)
- Parameters:
bufferSize- the size of buffer used to read data from the input stream
-
-