Package org.restlet.ext.html
Class FormDataSet
- java.lang.Object
-
- org.restlet.representation.Variant
-
- org.restlet.representation.RepresentationInfo
-
- org.restlet.representation.Representation
-
- org.restlet.representation.StreamRepresentation
-
- org.restlet.representation.OutputRepresentation
-
- org.restlet.ext.html.FormDataSet
-
public class FormDataSet extends org.restlet.representation.OutputRepresentation
HTML form supporting either URL encoding or multipart encoding.- Author:
- Jerome Louvel
-
-
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.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
-
-
-
-
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 classorg.restlet.representation.Representation
- Throws:
java.io.IOException
-
-