|
|||||||||
| 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:
| Constructor Summary | |
|---|---|
FormDataBodyPart()
Instantiate an unnamed new FormDataBodyPart with a
mediaType of text/plain. |
|
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 | ||
|---|---|---|
java.lang.String |
getName()
Return the field name for this body part, or null
if no name has been established yet. |
|
java.lang.String |
getValue()
Return the field value for this body part. |
|
|
getValueAs(java.lang.Class<T> clazz)
Return the field value after appropriate conversion to the requested type. |
|
boolean |
isSimple()
Return a flag indicating whether this FormDataBodyPart
represents a simple String-valued field. |
|
void |
setName(java.lang.String name)
Set the field name for this body part. |
|
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, 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()
Instantiate an unnamed new FormDataBodyPart with a
mediaType of text/plain.
public FormDataBodyPart(javax.ws.rs.core.MediaType mediaType)
Instantiate an unnamed FormDataBodyPart with the
specified characteristics.
mediaType - The MediaType for this body part
public FormDataBodyPart(java.lang.Object entity,
javax.ws.rs.core.MediaType mediaType)
Instantiate an unnamed FormDataBodyPart with the
specified characteristics.
entity - The entity for this body partmediaType - The MediaType for this body part
public FormDataBodyPart(java.lang.String name,
java.lang.String value)
Instantiate a named FormDataBodyPart with a
media type of text/plain and String value.
name - Field name for this body partvalue - Field value for this body part
public FormDataBodyPart(java.lang.String name,
java.lang.Object entity,
javax.ws.rs.core.MediaType mediaType)
Instantiate a named FormDataBodyPart with the
specified characteristics.
name - Field name for this body partentity - The entity for this body partmediaType - The MediaType for this body part| Method Detail |
|---|
public java.lang.String getName()
Return the field name for this body part, or null
if no name has been established yet.
public java.lang.String getValue()
Return the field value for this body part. This should be called only on body parts representing simple field values.
java.lang.IllegalStateException - if called on a body part with a
media type other than text/plainpublic <T> T getValueAs(java.lang.Class<T> clazz)
Return the field value after appropriate conversion to the requested
type. This is useful only when the containing FormDataMultiPart
instance has been received, which causes the providers property
to have been set.
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 boolean isSimple()
Return a flag indicating whether this FormDataBodyPart
represents a simple String-valued field.
public void setName(java.lang.String name)
Set the field name for this body part.
name - New field name for this body partpublic void setValue(java.lang.String value)
Set the field value for this body part. This should be called only on body parts representing simple field values.
value - The new 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)
Set the field media type and value for this body part.
mediaType - Media type for this field valuevalue - Field value as a Java object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||