Class MultiPart
java.lang.Object
org.glassfish.jersey.media.multipart.BodyPart
org.glassfish.jersey.media.multipart.MultiPart
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
FormDataMultiPart
A mutable model representing a MIME MultiPart entity. This class extends
BodyPart
because MultiPart entities can be nested inside other
MultiPart entities to an arbitrary depth.- Author:
- Craig McClanahan, Paul Sandoz, Michal Gajdos
-
Field Summary
Fields inherited from class org.glassfish.jersey.media.multipart.BodyPart
contentDisposition, messageBodyWorkers
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Performs any necessary cleanup at the end of processing thisMultiPart
.void
close()
Override the entity set operation on aMultiPart
to throwIllegalArgumentException
.Disables access to the entity for aMultiPart
.void
Disables access to the entity for aMultiPart
.void
setMediaType
(MediaType mediaType) Builder pattern method to return thisMultiPart
after additional configuration.Methods inherited from class org.glassfish.jersey.media.multipart.BodyPart
contentDisposition, getContentDisposition, getEntityAs, getHeaders, getMediaType, getParameterizedHeaders, getParent, getProviders, setContentDisposition, setMessageBodyWorkers, setParent, setProviders
-
Constructor Details
-
Method Details
-
getBodyParts
-
getEntity
Disables access to the entity for aMultiPart
. Use the list returned bygetBodyParts()
to access the relevantBodyPart
instead.- Overrides:
getEntity
in classBodyPart
- Returns:
- an entity of this body part.
- Throws:
IllegalStateException
- thrown unconditionally.
-
setEntity
-
setMediaType
- Overrides:
setMediaType
in classBodyPart
- Parameters:
mediaType
- the newMediaType
.- Throws:
IllegalArgumentException
- if thetype
property is not set tomultipart
.
-
bodyPart
- Parameters:
bodyPart
-BodyPart
to be added.
-
bodyPart
- Parameters:
entity
- entity object for this body part.mediaType
- content type for this body part.
-
entity
Override the entity set operation on aMultiPart
to throwIllegalArgumentException
. -
type
Builder pattern method to return thisMultiPart
after additional configuration. -
cleanup
public void cleanup()Performs any necessary cleanup at the end of processing thisMultiPart
. -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-