Class MultiPart
- java.lang.Object
-
- org.glassfish.jersey.media.multipart.BodyPart
-
- org.glassfish.jersey.media.multipart.MultiPart
-
- All Implemented Interfaces:
Closeable,AutoCloseable,org.glassfish.jersey.innate.spi.MessageBodyWorkersSettable
- Direct Known Subclasses:
FormDataMultiPart
public class MultiPart extends BodyPart implements Closeable
A mutable model representing a MIME MultiPart entity. This class extendsBodyPartbecause 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiPartbodyPart(Object entity, MediaType mediaType)MultiPartbodyPart(BodyPart bodyPart)voidcleanup()Performs any necessary cleanup at the end of processing thisMultiPart.voidclose()BodyPartentity(Object entity)Override the entity set operation on aMultiPartto throwIllegalArgumentException.List<BodyPart>getBodyParts()ObjectgetEntity()Disables access to the entity for aMultiPart.voidsetEntity(Object entity)Disables access to the entity for aMultiPart.voidsetMediaType(MediaType mediaType)MultiParttype(MediaType type)Builder pattern method to return thisMultiPartafter additional configuration.-
Methods inherited from class org.glassfish.jersey.media.multipart.BodyPart
contentDisposition, getContentDisposition, getEntityAs, getHeaders, getMediaType, getParameterizedHeaders, getParent, getProviders, setContentDisposition, setMessageBodyWorkers, setParent, setProviders
-
-
-
-
Method Detail
-
getEntity
public Object getEntity()
Disables access to the entity for aMultiPart. Use the list returned bygetBodyParts()to access the relevantBodyPartinstead.- Overrides:
getEntityin classBodyPart- Returns:
- an entity of this body part.
- Throws:
IllegalStateException- thrown unconditionally.
-
setEntity
public void setEntity(Object entity)
-
setMediaType
public void setMediaType(MediaType mediaType)
- Overrides:
setMediaTypein classBodyPart- Parameters:
mediaType- the newMediaType.- Throws:
IllegalArgumentException- if thetypeproperty is not set tomultipart.
-
bodyPart
public MultiPart bodyPart(Object entity, MediaType mediaType)
- Parameters:
entity- entity object for this body part.mediaType- content type for this body part.
-
entity
public BodyPart entity(Object entity)
Override the entity set operation on aMultiPartto throwIllegalArgumentException.
-
type
public MultiPart type(MediaType type)
Builder pattern method to return thisMultiPartafter additional configuration.
-
cleanup
public void cleanup()
Performs any necessary cleanup at the end of processing thisMultiPart.
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-