public class MultiPart extends BodyPart implements Closeable
BodyPart
because MultiPart entities can be nested inside other
MultiPart entities to an arbitrary depth.contentDisposition, messageBodyWorkers
Constructor and Description |
---|
MultiPart()
|
MultiPart(MediaType mediaType)
Instantiates a new
MultiPart with the specified characteristics. |
Modifier and Type | Method and Description |
---|---|
MultiPart |
bodyPart(BodyPart bodyPart)
|
MultiPart |
bodyPart(Object entity,
MediaType mediaType)
|
void |
cleanup()
Performs 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()
Disables access to the entity for a
MultiPart . |
void |
setEntity(Object entity)
Disables access to the entity for a
MultiPart . |
void |
setMediaType(MediaType mediaType)
|
MultiPart |
type(MediaType type)
Builder pattern method to return this
MultiPart after
additional configuration. |
contentDisposition, getContentDisposition, getEntityAs, getHeaders, getMediaType, getParameterizedHeaders, getParent, getProviders, setContentDisposition, setMessageBodyWorkers, setParent, setProviders
public Object getEntity()
MultiPart
. Use the list
returned by getBodyParts()
to access the relevant
BodyPart
instead.getEntity
in class BodyPart
IllegalStateException
- thrown unconditionally.public void setEntity(Object entity)
public void setMediaType(MediaType mediaType)
setMediaType
in class BodyPart
mediaType
- the new MediaType
.IllegalArgumentException
- if the type
property is not set to multipart
.public MultiPart bodyPart(Object entity, MediaType mediaType)
entity
- entity object for this body part.mediaType
- content type for this body part.public BodyPart entity(Object entity)
MultiPart
to throw
IllegalArgumentException
.public MultiPart type(MediaType type)
MultiPart
after
additional configuration.public void cleanup()
MultiPart
.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2007-2023, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.