|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.jersey.media.multipart.BodyPart
public class BodyPart
A mutable model representing a body part nested inside a MIME MultiPart entity.
| Field Summary | |
|---|---|
protected ContentDisposition |
contentDisposition
|
MessageBodyWorkers |
messageBodyWorkers
|
| Constructor Summary | |
|---|---|
BodyPart()
Instantiates a new BodyPart with a mediaType of
text/plain. |
|
BodyPart(MediaType mediaType)
Instantiates a new BodyPart with the specified characteristics. |
|
BodyPart(java.lang.Object entity,
MediaType mediaType)
Instantiates a new BodyPart with the specified characteristics. |
|
| Method Summary | ||
|---|---|---|
void |
cleanup()
Perform any necessary cleanup at the end of processing this BodyPart. |
|
BodyPart |
contentDisposition(ContentDisposition contentDisposition)
Builder pattern method to return this BodyPart after
additional configuration. |
|
BodyPart |
entity(java.lang.Object entity)
Builder pattern method to return this BodyPart after
additional configuration. |
|
ContentDisposition |
getContentDisposition()
Gets the content disposition. |
|
java.lang.Object |
getEntity()
Returns the entity object to be unmarshalled from a request, or to be marshalled on a response. |
|
|
getEntityAs(java.lang.Class<T> clazz)
Returns the entity after appropriate conversion to the requested type. |
|
MultivaluedMap<java.lang.String,java.lang.String> |
getHeaders()
Returns a mutable map of HTTP header value(s) for this BodyPart,
keyed by the header name. |
|
MediaType |
getMediaType()
Returns the MediaType for this BodyPart. |
|
MultivaluedMap<java.lang.String,ParameterizedHeader> |
getParameterizedHeaders()
Returns an immutable map of parameterized HTTP header value(s) for this BodyPart, keyed by header name. |
|
MultiPart |
getParent()
Returns the parent MultiPart (if any) for this BodyPart. |
|
Providers |
getProviders()
Returns the configured Providers for this BodyPart. |
|
void |
setContentDisposition(ContentDisposition contentDisposition)
Sets the content disposition. |
|
void |
setEntity(java.lang.Object entity)
Set the entity object to be unmarshalled from a request, or to be marshalled on a response. |
|
void |
setMediaType(MediaType mediaType)
Sets the MediaType for this BodyPart. |
|
void |
setMessageBodyWorkers(MessageBodyWorkers messageBodyWorkers)
|
|
void |
setParent(MultiPart parent)
Sets the parent MultiPart (if any) for this BodyPart. |
|
void |
setProviders(Providers providers)
Sets the configured Providers for this BodyPart. |
|
BodyPart |
type(MediaType type)
Builder pattern method to return this BodyPart after
additional configuration. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ContentDisposition contentDisposition
public MessageBodyWorkers messageBodyWorkers
| Constructor Detail |
|---|
public BodyPart()
BodyPart with a mediaType of
text/plain.
public BodyPart(MediaType mediaType)
BodyPart with the specified characteristics.
mediaType - MediaType for this body part.
public BodyPart(java.lang.Object entity,
MediaType mediaType)
BodyPart with the specified characteristics.
entity - entity for this body part.mediaType - MediaType for this body part.| Method Detail |
|---|
public java.lang.Object getEntity()
java.lang.IllegalStateException - if this method is called on a MultiPart instance; access the underlying BodyParts insteadpublic void setEntity(java.lang.Object entity)
entity - the new entity object.
java.lang.IllegalStateException - if this method is called on a MultiPart instance; access the underlying BodyParts insteadpublic MultivaluedMap<java.lang.String,java.lang.String> getHeaders()
BodyPart,
keyed by the header name. Key comparisons in the returned map must be
case-insensitive.
Note: MIME specifications says only headers that match
Content-* should be included on a BodyPart.
public MultivaluedMap<java.lang.String,ParameterizedHeader> getParameterizedHeaders()
throws java.text.ParseException
BodyPart, keyed by header name. Key comparisons in the
returned map must be case-insensitive. If you wish to modify the
headers map for this BodyPart, modify the map returned by
getHeaders() instead.
java.text.ParseExceptionpublic ContentDisposition getContentDisposition()
java.lang.IllegalArgumentException - if the content disposition header
cannot be parsed.public void setContentDisposition(ContentDisposition contentDisposition)
contentDisposition - the content disposition.public MediaType getMediaType()
MediaType for this BodyPart. If not
set, the default MediaType MUST be text/plain.
public void setMediaType(MediaType mediaType)
MediaType for this BodyPart.
mediaType - the new MediaType.
java.lang.IllegalArgumentException - if the mediaType is null.public MultiPart getParent()
MultiPart (if any) for this BodyPart.
null if not set.public void setParent(MultiPart parent)
MultiPart (if any) for this BodyPart.
parent - the new parent.public Providers getProviders()
Providers for this BodyPart.
public void setProviders(Providers providers)
Providers for this BodyPart.
providers - the new Providers.public void cleanup()
BodyPart.
public BodyPart entity(java.lang.Object entity)
BodyPart after
additional configuration.
entity - entity to set for this BodyPart.public <T> T getEntityAs(java.lang.Class<T> clazz)
MultiPart
instance has been received, which causes the providers property
to have been set.
clazz - desired class into which the entity should be converted.
java.lang.IllegalArgumentException - if no MessageBodyReader can be found to perform the requested conversion.
java.lang.IllegalStateException - if this method is called when the providers property has not been set or
when the entity instance is not the unconverted content of the body part entity.public BodyPart type(MediaType type)
BodyPart after
additional configuration.
type - media type to set for this BodyPart.public BodyPart contentDisposition(ContentDisposition contentDisposition)
BodyPart after
additional configuration.
contentDisposition - content disposition to set for this BodyPart.public void setMessageBodyWorkers(MessageBodyWorkers messageBodyWorkers)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||