Class FormDataSet


  • public class FormDataSet
    extends org.restlet.representation.OutputRepresentation
    HTML form supporting either URL encoding or multipart encoding.
    Author:
    Jerome Louvel
    • Field Summary

      • Fields inherited from class org.restlet.representation.Representation

        UNKNOWN_SIZE
    • Constructor Summary

      Constructors 
      Constructor Description
      FormDataSet()
      Default constructor, creates a single part form.
      FormDataSet​(java.lang.String multipartBoundary)
      Creates a multipart form.
      FormDataSet​(org.restlet.representation.Representation formRepresentation)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      FormData add​(java.lang.String name, java.lang.String value)
      Adds a new form data entry.
      java.lang.String encode()
      Encodes the form using the standard HTML form encoding mechanism and the UTF-8 character set.
      java.lang.String encode​(boolean queryString)
      Encodes the form using the standard URI encoding mechanism and the UTF-8 character set.
      java.lang.String encode​(char separator, boolean queryString)
      URL encodes the form.
      org.restlet.util.Series<FormData> getEntries()
      Returns the modifiable series of form entries.
      java.lang.String getMatrixString()
      Formats the form as a matrix path string.
      java.lang.String getMultipartBoundary()
      Returns the boundary separating multipart entries.
      java.lang.String getQueryString()
      Formats the form as a query string.
      boolean isMultipart()
      Indicates if the form is multipart encoded.
      void setMultipart​(boolean multipart)
      Indicates if the form is multipart encoded.
      void setMultipartBoundary​(java.lang.String boundary)
      Sets the boundary separating multipart entries.
      void write​(java.io.OutputStream outputStream)  
      • Methods inherited from class org.restlet.representation.OutputRepresentation

        getChannel, getStream
      • Methods inherited from class org.restlet.representation.StreamRepresentation

        getReader, write, write
      • Methods inherited from class org.restlet.representation.Representation

        append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
      • Methods inherited from class org.restlet.representation.RepresentationInfo

        getModificationDate, getTag, setModificationDate, setTag
      • Methods inherited from class org.restlet.representation.Variant

        createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, hashCode, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
      • Methods inherited from class java.lang.Object

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

      • FormDataSet

        public FormDataSet()
        Default constructor, creates a single part form.
      • FormDataSet

        public FormDataSet​(org.restlet.representation.Representation formRepresentation)
        Constructor.
        Parameters:
        formRepresentation - The representation to parse.
      • FormDataSet

        public FormDataSet​(java.lang.String multipartBoundary)
        Creates a multipart form.
        Parameters:
        multipartBoundary - The boundary separating multipart entries.
    • Method Detail

      • add

        public FormData add​(java.lang.String name,
                            java.lang.String value)
        Adds a new form data entry.
        Parameters:
        name - The entry name.
        value - The entry value.
        Returns:
        The entry created and added to getEntries().
      • encode

        public java.lang.String encode()
                                throws java.io.IOException
        Encodes the form using the standard HTML form encoding mechanism and the UTF-8 character set.
        Returns:
        The encoded form.
        Throws:
        java.io.IOException
      • encode

        public java.lang.String encode​(boolean queryString)
                                throws java.io.IOException
        Encodes the form using the standard URI encoding mechanism and the UTF-8 character set.
        Parameters:
        queryString - True if the target is a query string.
        Returns:
        The encoded form.
        Throws:
        java.io.IOException
      • encode

        public java.lang.String encode​(char separator,
                                       boolean queryString)
                                throws java.io.IOException
        URL encodes the form.
        Parameters:
        separator - The separator character to append between parameters.
        queryString - True if the target is a query string.
        Returns:
        The encoded form.
        Throws:
        java.io.IOException
      • getEntries

        public org.restlet.util.Series<FormData> getEntries()
        Returns the modifiable series of form entries.
        Returns:
        The modifiable series of form entries.
      • getMatrixString

        public java.lang.String getMatrixString()
        Formats the form as a matrix path string. Uses UTF-8 as the character set for encoding non-ASCII characters.
        Returns:
        The form as a matrix string.
        See Also:
        Matrix URIs by Tim Berners Lee
      • getMultipartBoundary

        public java.lang.String getMultipartBoundary()
        Returns the boundary separating multipart entries.
        Returns:
        The boundary separating multipart entries.
      • getQueryString

        public java.lang.String getQueryString()
        Formats the form as a query string. Uses UTF-8 as the character set for encoding non-ASCII characters.
        Returns:
        The form as a query string.
      • isMultipart

        public boolean isMultipart()
        Indicates if the form is multipart encoded.
        Returns:
        True if the form is multipart encoded.
      • setMultipart

        public void setMultipart​(boolean multipart)
        Indicates if the form is multipart encoded.
        Parameters:
        multipart - True if the form is multipart encoded.
      • setMultipartBoundary

        public void setMultipartBoundary​(java.lang.String boundary)
        Sets the boundary separating multipart entries.
        Parameters:
        boundary - The boundary separating multipart entries.
      • write

        public void write​(java.io.OutputStream outputStream)
                   throws java.io.IOException
        Specified by:
        write in class org.restlet.representation.Representation
        Throws:
        java.io.IOException