public class MultiPart extends BodyPart implements Closeable
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.
| Constructor and Description |
|---|
MultiPart()
|
MultiPart(javax.ws.rs.core.MediaType mediaType)
Instantiate a new
MultiPart with the specified characteristics. |
| Modifier and Type | Method and Description |
|---|---|
MultiPart |
bodyPart(BodyPart bodyPart)
|
MultiPart |
bodyPart(Object entity,
javax.ws.rs.core.MediaType mediaType)
|
void |
cleanup()
Perform any necessary cleanup at the end of processing this
MultiPart. |
void |
close() |
BodyPart |
entity(Object entity)
Override the entity set operation on a
MultiPart to throw
IllegalArgumentException. |
List<BodyPart> |
getBodyParts()
|
Object |
getEntity()
Disable access to the entity for a
MultiPart. |
void |
setEntity(Object entity)
Disable access to the entity for a
MultiPart. |
void |
setMediaType(javax.ws.rs.core.MediaType mediaType)
Set the
MediaType for this MultiPart. |
MultiPart |
type(javax.ws.rs.core.MediaType type)
Builder pattern method to return this
MultiPart after
additional configuration. |
contentDisposition, getContentDisposition, getEntityAs, getHeaders, getMediaType, getParameterizedHeaders, getParent, getProviders, setContentDisposition, setParent, setProviderspublic MultiPart()
Instantiate a new MultiPart with a mediaType of
multipart/mixed.
public MultiPart(javax.ws.rs.core.MediaType mediaType)
Instantiate a new MultiPart with the specified characteristics.
mediaType - The MediaType for this multipartpublic Object getEntity()
Disable access to the entity for a MultiPart. Use the list
returned by getBodyParts() to access the relevant
BodyPart instead.
getEntity in class BodyPartIllegalStateException - thrown unconditionallypublic void setEntity(Object entity)
public void setMediaType(javax.ws.rs.core.MediaType mediaType)
Set the MediaType for this MultiPart. If never set,
the default MediaType MUST be multipart/mixed.
setMediaType in class BodyPartmediaType - The new MediaTypeIllegalArgumentException - if the type property
is not set to multipartpublic MultiPart bodyPart(Object entity, javax.ws.rs.core.MediaType mediaType)
entity - Entity object for this body partmediaType - Content type for this body partpublic BodyPart entity(Object entity)
Override the entity set operation on a MultiPart to throw
IllegalArgumentException.
public MultiPart type(javax.ws.rs.core.MediaType type)
Builder pattern method to return this MultiPart after
additional configuration.
public void cleanup()
Perform any necessary cleanup at the end of processing this
MultiPart.
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2014 Oracle Corporation. All rights reserved.