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.-
Field Summary
FieldsFields inherited from class org.glassfish.jersey.media.multipart.BodyPart
contentDisposition, messageBodyWorkers
-
Constructor Summary
Constructors -
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
(javax.ws.rs.core.MediaType mediaType) Sets theMediaType
for thisMultiPart
.type
(javax.ws.rs.core.MediaType type) 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
-
Field Details
-
bodyParts
-
-
Constructor Details
-
MultiPart
public MultiPart() -
MultiPart
public MultiPart(javax.ws.rs.core.MediaType mediaType) Instantiates a newMultiPart
with the specified characteristics.- Parameters:
mediaType
- theMediaType
for this multipart.
-
-
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
public void setMediaType(javax.ws.rs.core.MediaType mediaType) - 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
-