|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jersey.multipart.BodyPart
com.sun.jersey.multipart.FormDataBodyPart
public class FormDataBodyPart
Subclass of BodyPart
with specialized support for media type
multipart/form-data
. See
RFC 2388
for the formal definition of this media type.
For a server side application wishing to process an incoming
multipart/form-data
message, the following features
are provided:
MessageBodyReader
.For a client side application wishing to construct an outgoing
multipart/form-data
message, the following features
are provided:
Field Summary |
---|
Fields inherited from class com.sun.jersey.multipart.BodyPart |
---|
cd |
Constructor Summary | |
---|---|
FormDataBodyPart()
FormDataBodyPart with a
mediaType of text/plain . |
|
FormDataBodyPart(FormDataContentDisposition fdcd,
java.lang.Object entity,
javax.ws.rs.core.MediaType mediaType)
Instantiate a named FormDataBodyPart with the
specified characteristics. |
|
FormDataBodyPart(FormDataContentDisposition fdcd,
java.lang.String value)
Instantiate a named FormDataBodyPart with the
specified characteristics. |
|
FormDataBodyPart(javax.ws.rs.core.MediaType mediaType)
Instantiate an unnamed FormDataBodyPart with the
specified characteristics. |
|
FormDataBodyPart(java.lang.Object entity,
javax.ws.rs.core.MediaType mediaType)
Instantiate an unnamed FormDataBodyPart with the
specified characteristics. |
|
FormDataBodyPart(java.lang.String name,
java.lang.Object entity,
javax.ws.rs.core.MediaType mediaType)
Instantiate a named FormDataBodyPart with the
specified characteristics. |
|
FormDataBodyPart(java.lang.String name,
java.lang.String value)
Instantiate a named FormDataBodyPart with a
media type of text/plain and String value. |
Method Summary | ||
---|---|---|
ContentDisposition |
getContentDisposition()
Override the behaviour on BodyPart to ensure that
only instances of FormDataContentDisposition can be obtained. |
|
FormDataContentDisposition |
getFormDataContentDisposition()
Get the form data content disposition. |
|
java.lang.String |
getName()
Get the control name. |
|
java.lang.String |
getValue()
Get the field value for this body part. |
|
|
getValueAs(java.lang.Class<T> clazz)
Get the field value after appropriate conversion to the requested type. |
|
boolean |
isSimple()
|
|
void |
setContentDisposition(ContentDisposition cd)
Override the behaviour on BodyPart to ensure that
only instances of FormDataContentDisposition can be set. |
|
void |
setFormDataContentDisposition(FormDataContentDisposition cd)
Set the form data content disposition. |
|
void |
setName(java.lang.String name)
Set the control name. |
|
void |
setValue(javax.ws.rs.core.MediaType mediaType,
java.lang.Object value)
Set the field media type and value for this body part. |
|
void |
setValue(java.lang.String value)
Set the field value for this body part. |
Methods inherited from class com.sun.jersey.multipart.BodyPart |
---|
cleanup, contentDisposition, entity, getEntity, getEntityAs, getHeaders, getMediaType, getParameterizedHeaders, getParent, getProviders, setEntity, setMediaType, setParent, setProviders, type |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FormDataBodyPart()
FormDataBodyPart
with a
mediaType
of text/plain
.
public FormDataBodyPart(javax.ws.rs.core.MediaType mediaType)
FormDataBodyPart
with the
specified characteristics.
mediaType
- The MediaType
for this body partpublic FormDataBodyPart(java.lang.Object entity, javax.ws.rs.core.MediaType mediaType)
FormDataBodyPart
with the
specified characteristics.
entity
- The entity for this body partmediaType
- The MediaType
for this body partpublic FormDataBodyPart(java.lang.String name, java.lang.String value)
FormDataBodyPart
with a
media type of text/plain
and String value.
name
- the control name for this body partvalue
- the value for this body partpublic FormDataBodyPart(java.lang.String name, java.lang.Object entity, javax.ws.rs.core.MediaType mediaType)
FormDataBodyPart
with the
specified characteristics.
name
- the control name for this body partentity
- the entity for this body partmediaType
- the MediaType
for this body partpublic FormDataBodyPart(FormDataContentDisposition fdcd, java.lang.String value)
FormDataBodyPart
with the
specified characteristics.
fdcd
- the content disposition header for this body part.value
- the value for this body partpublic FormDataBodyPart(FormDataContentDisposition fdcd, java.lang.Object entity, javax.ws.rs.core.MediaType mediaType)
FormDataBodyPart
with the
specified characteristics.
fdcd
- the content disposition header for this body part.entity
- The entity for this body partmediaType
- The MediaType
for this body partMethod Detail |
---|
public FormDataContentDisposition getFormDataContentDisposition()
public void setFormDataContentDisposition(FormDataContentDisposition cd)
cd
- the form data content disposition.public ContentDisposition getContentDisposition()
BodyPart
to ensure that
only instances of FormDataContentDisposition
can be obtained.
getContentDisposition
in class BodyPart
java.lang.IllegalArgumentException
- if the content disposition header
cannot be parsed.public void setContentDisposition(ContentDisposition cd)
BodyPart
to ensure that
only instances of FormDataContentDisposition
can be set.
setContentDisposition
in class BodyPart
cd
- the content disposition which must be an instance
of FormDataContentDisposition
.
java.lang.IllegalArgumentException
- if the content disposition is not an
instance of FormDataContentDisposition
.public java.lang.String getName()
public void setName(java.lang.String name)
name
- the control name.public java.lang.String getValue()
java.lang.IllegalStateException
- if called on a body part with a
media type other than text/plain
public <T> T getValueAs(java.lang.Class<T> clazz)
FormDataMultiPart
instance has been received, which causes the providers
property to have been set.
T
- the type of the field value.clazz
- Desired class into which the field value 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
entitypublic void setValue(java.lang.String value)
value
- the field value
java.lang.IllegalStateException
- if called on a body part with a
media type other than text/plain
public void setValue(javax.ws.rs.core.MediaType mediaType, java.lang.Object value)
mediaType
- the media type for this field valuevalue
- the field value as a Java objectpublic boolean isSimple()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |