Package org.restlet.ext.html
Class FormData
- java.lang.Object
-
- org.restlet.ext.html.FormData
-
- All Implemented Interfaces:
NamedValue<java.lang.String>
public class FormData extends java.lang.Object implements NamedValue<java.lang.String>
HTML form data composed of a name and a value. The value is typically a string but can also be a full fledged representation for multipart form (such as a binary file uploaded).
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringnameThe name of the associated form control.private RepresentationvalueRepresentationThe value of the associated form control as a full fledged representation.
-
Constructor Summary
Constructors Constructor Description FormData(java.lang.String name, java.lang.String value)Constructor.FormData(java.lang.String name, Representation valueRepresentation)Constructor.FormData(NamedValue<java.lang.String> namedValue)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringencode(boolean queryString)Encodes the parameter as a string.voidencode(java.lang.Appendable buffer, boolean queryString)Encodes the parameter into the target buffer.DispositiongetDisposition()Returns the content disposition of the value representation.java.lang.StringgetFilename()Returns the file name of the value representation.MediaTypegetMediaType()Returns the media type of the value representation.java.lang.StringgetName()Returns the name of the associated form control.java.lang.StringgetValue()Returns the textual value of the associated form control.RepresentationgetValueRepresentation()Returns the value of the associated form control, either textual or binary.voidsetName(java.lang.String name)Sets the name of the associated form control.voidsetValue(java.lang.String value)Sets the textual value of the associated form control.voidsetValueRepresentation(Representation valueRepresentation)Sets the value of the associated form control as a full fledged representation.java.lang.StringtoString()
-
-
-
Field Detail
-
name
private volatile java.lang.String name
The name of the associated form control.
-
valueRepresentation
private volatile Representation valueRepresentation
The value of the associated form control as a full fledged representation.
-
-
Constructor Detail
-
FormData
public FormData(NamedValue<java.lang.String> namedValue)
Constructor.- Parameters:
namedValue-
-
FormData
public FormData(java.lang.String name, Representation valueRepresentation)Constructor.- Parameters:
name-valueRepresentation-
-
FormData
public FormData(java.lang.String name, java.lang.String value)Constructor.- Parameters:
name-value-
-
-
Method Detail
-
encode
public void encode(java.lang.Appendable buffer, boolean queryString) throws java.io.IOExceptionEncodes the parameter into the target buffer.- Parameters:
buffer- The target buffer.queryString- True if the target is a query string.- Throws:
java.io.IOException
-
encode
public java.lang.String encode(boolean queryString) throws java.io.IOExceptionEncodes the parameter as a string.- Parameters:
queryString- True if the target is a query string.- Returns:
- The encoded string.
- Throws:
java.io.IOException
-
getDisposition
public Disposition getDisposition()
Returns the content disposition of the value representation.- Returns:
- The content disposition of the value representation.
-
getFilename
public java.lang.String getFilename()
Returns the file name of the value representation. To get this information, theDisposition.getFilename()method is invoked.- Returns:
- The file name of the value representation.
-
getMediaType
public MediaType getMediaType()
Returns the media type of the value representation.- Returns:
- The media type of the value representation.
-
getName
public java.lang.String getName()
Returns the name of the associated form control.- Specified by:
getNamein interfaceNamedValue<java.lang.String>- Returns:
- The name of the associated form control.
-
getValue
public java.lang.String getValue()
Returns the textual value of the associated form control.- Specified by:
getValuein interfaceNamedValue<java.lang.String>- Returns:
- The textual value of the associated form control.
-
getValueRepresentation
public Representation getValueRepresentation()
Returns the value of the associated form control, either textual or binary.- Returns:
- The value of the associated form control.
-
setName
public void setName(java.lang.String name)
Sets the name of the associated form control.- Parameters:
name- The name of the associated form control.
-
setValue
public void setValue(java.lang.String value)
Sets the textual value of the associated form control.- Specified by:
setValuein interfaceNamedValue<java.lang.String>- Parameters:
value- The textual value of the associated form control.
-
setValueRepresentation
public void setValueRepresentation(Representation valueRepresentation)
Sets the value of the associated form control as a full fledged representation.- Parameters:
valueRepresentation- The value of the associated form control.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-