org.restlet.ext.html
Class FormData

java.lang.Object
  extended by org.restlet.ext.html.FormData
All Implemented Interfaces:
NamedValue<String>

public class FormData
extends Object
implements NamedValue<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).

Author:
Jerome Louvel

Constructor Summary
FormData(NamedValue<String> namedValue)
          Constructor.
FormData(String name, Representation valueRepresentation)
          Constructor.
FormData(String name, String value)
          Constructor.
 
Method Summary
 void encode(Appendable buffer, boolean queryString)
          Encodes the parameter into the target buffer.
 String encode(boolean queryString)
          Encodes the parameter as a string.
 Disposition getDisposition()
          Returns the content disposition of the value representation.
 String getFilename()
          Returns the file name of the value representation.
 MediaType getMediaType()
          Returns the media type of the value representation.
 String getName()
          Returns the name of the associated form control.
 String getValue()
          Returns the textual value of the associated form control.
 Representation getValueRepresentation()
          Returns the value of the associated form control, either textual or binary.
 void setName(String name)
          Sets the name of the associated form control.
 void setValue(String value)
          Sets the textual value of the associated form control.
 void setValueRepresentation(Representation valueRepresentation)
          Sets the value of the associated form control as a full fledged representation.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FormData

public FormData(NamedValue<String> namedValue)
Constructor.

Parameters:
namedValue -

FormData

public FormData(String name,
                Representation valueRepresentation)
Constructor.

Parameters:
name -
valueRepresentation -

FormData

public FormData(String name,
                String value)
Constructor.

Parameters:
name -
value -
Method Detail

encode

public String encode(boolean queryString)
              throws IOException
Encodes the parameter as a string.

Parameters:
queryString - True if the target is a query string.
Returns:
The encoded string.
Throws:
IOException

encode

public void encode(Appendable buffer,
                   boolean queryString)
            throws IOException
Encodes the parameter into the target buffer.

Parameters:
buffer - The target buffer.
queryString - True if the target is a query string.
Throws:
IOException

getDisposition

public Disposition getDisposition()
Returns the content disposition of the value representation.

Returns:
The content disposition of the value representation.

getFilename

public String getFilename()
Returns the file name of the value representation. To get this information, the Disposition.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 String getName()
Returns the name of the associated form control.

Specified by:
getName in interface NamedValue<String>
Returns:
The name of the associated form control.

getValue

public String getValue()
Returns the textual value of the associated form control.

Specified by:
getValue in interface NamedValue<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(String name)
Sets the name of the associated form control.

Parameters:
name - The name of the associated form control.

setValue

public void setValue(String value)
Sets the textual value of the associated form control.

Specified by:
setValue in interface NamedValue<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 String toString()
Overrides:
toString in class Object


Copyright © 2005-2013 Restlet.