|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jersey.multipart.BodyPart
public class BodyPart
A mutable model representing a body part nested inside a MIME MultiPart entity.
Field Summary | |
---|---|
protected ContentDisposition |
cd
|
Constructor Summary | |
---|---|
BodyPart()
Instantiate a new BodyPart with a mediaType of
text/plain . |
|
BodyPart(MediaType mediaType)
Instantiate a new BodyPart with the specified characteristics. |
|
BodyPart(Object entity,
MediaType mediaType)
Instantiate 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 cd)
|
|
BodyPart |
entity(Object entity)
Builder pattern method to return this BodyPart after
additional configuration. |
|
ContentDisposition |
getContentDisposition()
Get the content disposition. |
|
Object |
getEntity()
Return the entity object to be unmarshalled from a request, or to be marshalled on a response. |
|
|
getEntityAs(Class<T> clazz)
Return the entity after appropriate conversion to the requested type. |
|
MultivaluedMap<String,String> |
getHeaders()
Return a mutable map of HTTP header value(s) for this BodyPart ,
keyed by the header name. |
|
MediaType |
getMediaType()
Return the MediaType for this BodyPart . |
|
MultivaluedMap<String,ParameterizedHeader> |
getParameterizedHeaders()
Return an immutable map of parameterized HTTP header value(s) for this BodyPart , keyed by header name. |
|
MultiPart |
getParent()
Return the parent MultiPart (if any) for this BodyPart . |
|
Providers |
getProviders()
Return the configured Providers for this BodyPart . |
|
void |
setContentDisposition(ContentDisposition cd)
Set the content disposition. |
|
void |
setEntity(Object entity)
Set the entity object to be unmarshalled from a request, or to be marshalled on a response. |
|
void |
setMediaType(MediaType mediaType)
Set the MediaType for this BodyPart . |
|
void |
setParent(MultiPart parent)
Set the parent MultiPart (if any) for this BodyPart . |
|
void |
setProviders(Providers providers)
Set 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 cd
Constructor Detail |
---|
public BodyPart()
Instantiate a new BodyPart
with a mediaType
of
text/plain
.
public BodyPart(MediaType mediaType)
Instantiate a new BodyPart
with the specified characteristics.
mediaType
- The MediaType
for this body partpublic BodyPart(Object entity, MediaType mediaType)
Instantiate a new BodyPart
with the specified characteristics.
entity
- The entity for this body partmediaType
- The MediaType
for this body partMethod Detail |
---|
public Object getEntity()
Return the entity object to be unmarshalled from a request, or to be marshalled on a response.
IllegalStateException
- if this method is called on a
MultiPart
instance; access the underlying BodyPart
s insteadpublic void setEntity(Object entity)
Set the entity object to be unmarshalled from a request, or to be marshalled on a response.
entity
- The new entity object
IllegalStateException
- if this method is called on a
MultiPart
instance; access the underlying BodyPart
s insteadpublic MultivaluedMap<String,String> getHeaders()
Return a mutable map of HTTP header value(s) for this BodyPart
,
keyed by the header name. Key comparisons in the returned map must be
case-insensitive.
Note that, per the MIME specifications, only headers that match
Content-*
should be included on a BodyPart
.
public MultivaluedMap<String,ParameterizedHeader> getParameterizedHeaders() throws ParseException
Return an immutable map of parameterized HTTP header value(s) for this
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.
ParseException
public ContentDisposition getContentDisposition()
The "Content-Disposition" header, if present, will be parsed.
IllegalArgumentException
- if the content disposition header
cannot be parsed.public void setContentDisposition(ContentDisposition cd)
cd
- the content disposition.public MediaType getMediaType()
public void setMediaType(MediaType mediaType)
Set the MediaType
for this BodyPart
.
mediaType
- The new MediaType
IllegalArgumentException
- if the mediaType
is null.public MultiPart getParent()
public void setParent(MultiPart parent)
public Providers getProviders()
public void setProviders(Providers providers)
public void cleanup()
Perform any necessary cleanup at the end of processing this
BodyPart
.
public BodyPart entity(Object entity)
Builder pattern method to return this BodyPart
after
additional configuration.
entity
- Entity to set for this BodyPart
public <T> T getEntityAs(Class<T> clazz)
Return the entity after appropriate conversion to the requested
type. This is useful only when the containing MultiPart
instance has been received, which causes the providers
property
to have been set.
clazz
- Desired class into which the entity should be converted
IllegalArgumentException
- if no MessageBodyReader
can
be found to perform the requested conversion
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 entitypublic BodyPart type(MediaType type)
Builder pattern method to return this BodyPart
after
additional configuration.
type
- Media type to set for this BodyPart
public BodyPart contentDisposition(ContentDisposition cd)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |