Class MultiPart
Namespace class for interrelated classes that provide support for parsing and generating multipart bytes.
Most applications should make use of MultiPartFormData
or MultiPartByteRanges as they provide a simpler API.
Multipart parsing is provided by MultiPart.Parser.
Multipart generation is provided by MultiPart.AbstractContentSource and its subclasses.
A single part of a multipart content is represented by MultiPart.Part
and its subclasses.
- See Also:
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn asynchronousContent.SourcewhereMultiPart.Parts can be added to it to form a multipart content.static classAMultiPart.Parser.Listenerthat emitsMultiPart.Partobjects.static classAMultiPart.Partthat holds its content in memory, in one or moreByteBuffers.static classAMultiPart.Partthat holds its content in one or moreContent.Chunks.static classAMultiPart.Partwhose content is aContent.Source.static classAmultipart/form-dataparser that follows RFC 7578.static classA single part of a multipart content.static classAMultiPart.Partwhose content is in a file. - 
Method Summary
Modifier and TypeMethodDescriptionstatic StringencodeContentDispositionFileName(String fileName) Encode aContent-Dispositionfile name according to RFC8187 usingStandardCharsets.UTF_8static StringextractBoundary(String contentType) Extracts the value of theboundaryparameter from theContent-Typeheader value, or returnsnullif theboundaryparameter is missing.static StringgenerateBoundary(String prefix, int randomLength) Generates a multipart boundary, made of the given optional prefix string and the given number of random characters. 
- 
Method Details
- 
encodeContentDispositionFileName
Encode aContent-Dispositionfile name according to RFC8187 usingStandardCharsets.UTF_8- Parameters:
 fileName- The filename to encode- Returns:
 - The encoding of the filename suitable for a 
Content-Dispositionheader 
 - 
extractBoundary
Extracts the value of the
boundaryparameter from theContent-Typeheader value, or returnsnullif theboundaryparameter is missing.- Parameters:
 contentType- theContent-Typeheader value- Returns:
 - the value of the 
boundaryparameter, ornullif theboundaryparameter is missing 
 - 
generateBoundary
Generates a multipart boundary, made of the given optional prefix string and the given number of random characters.
The total length of the boundary will be trimmed to at most 70 characters, as specified in RFC 2046.
- Parameters:
 prefix- a possiblynullprefixrandomLength- a number of random characters to add after the prefix- Returns:
 - a boundary string
 
 
 -