Class FormData

  • All Implemented Interfaces:
    org.restlet.util.NamedValue<java.lang.String>

    public class FormData
    extends java.lang.Object
    implements org.restlet.util.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).
    Author:
    Jerome Louvel
    • Constructor Summary

      Constructors 
      Constructor Description
      FormData​(java.lang.String name, java.lang.String value)
      Constructor.
      FormData​(java.lang.String name, org.restlet.representation.Representation valueRepresentation)
      Constructor.
      FormData​(org.restlet.util.NamedValue<java.lang.String> namedValue)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String encode​(boolean queryString)
      Encodes the parameter as a string.
      void encode​(java.lang.Appendable buffer, boolean queryString)
      Encodes the parameter into the target buffer.
      org.restlet.data.Disposition getDisposition()
      Returns the content disposition of the value representation.
      java.lang.String getFilename()
      Returns the file name of the value representation.
      org.restlet.data.MediaType getMediaType()
      Returns the media type of the value representation.
      java.lang.String getName()
      Returns the name of the associated form control.
      java.lang.String getValue()
      Returns the textual value of the associated form control.
      org.restlet.representation.Representation getValueRepresentation()
      Returns the value of the associated form control, either textual or binary.
      void setName​(java.lang.String name)
      Sets the name of the associated form control.
      void setValue​(java.lang.String value)
      Sets the textual value of the associated form control.
      void setValueRepresentation​(org.restlet.representation.Representation valueRepresentation)
      Sets the value of the associated form control as a full fledged representation.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FormData

        public FormData​(org.restlet.util.NamedValue<java.lang.String> namedValue)
        Constructor.
        Parameters:
        namedValue -
      • FormData

        public FormData​(java.lang.String name,
                        org.restlet.representation.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.IOException
        Encodes 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.IOException
        Encodes 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 org.restlet.data.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, the Disposition.getFilename() method is invoked.
        Returns:
        The file name of the value representation.
      • getMediaType

        public org.restlet.data.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:
        getName in interface org.restlet.util.NamedValue<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:
        getValue in interface org.restlet.util.NamedValue<java.lang.String>
        Returns:
        The textual value of the associated form control.
      • getValueRepresentation

        public org.restlet.representation.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:
        setValue in interface org.restlet.util.NamedValue<java.lang.String>
        Parameters:
        value - The textual value of the associated form control.
      • setValueRepresentation

        public void setValueRepresentation​(org.restlet.representation.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:
        toString in class java.lang.Object