Class used to format data in the style of HTML forms submissions, as indicated in RFC 1867, RFC 2388, and the HTML 4.01 specification, including the older urlencoded style. Holds a set of
Notes
Example
|| make an HttpFormData, will default to multipart posting
let form-data:HttpFormData = {new HttpFormData}
|| add a string parameter
{form-data.append {new HttpFormStringParam, "field1", "value1"}}
let u:Url = {url "http://www.example.com/some-file.txt"}
|| add a files parameter, with one file in it
{form-data.append
{new HttpFormFilesParam,
"field2",
u.filename,
{read-bytes-from u}
}
}
|| now send our 2 parameter form to a webserver
let post-url:Url = {url "http://www.example.com/cgi-bin/script"}
|| will throw an HttpException if it can't get to
|| post-url, or if it returns some failure status code
let tis:TextInputStream =
{({post-url.instantiate-File} asa HttpFile).http-read-open
request-method = HttpRequestMethod.post,
request-data = form-data
}
let buf:StringBuf = {new StringBuf}
|| read in the contents that the server sent back
{try
{tis.read-one-string buf = buf}
finally
|| close the stream, since we read everything in
{tis.close}
}
| Create an |
| The content-type of the request data. |
| See |
| The mime-type to use to encode the data. |
| See |
| See |
| The MIME type name for the newer style of encoding form data, as specified in RFC 1867 and RFC 2388. This style can handle any sort of data, but may not be used in a URL's query string. The data to be used for MIME type comes from |
| The MIME type name for the older style of encoding form data. Note that this MIME type does not allow for flexible charset use, or for file uploads, but it can be used for the query string in a URL, as long as the amount of data is small. The data to be used for MIME type comes from |
| The data derived from the |
| The data derived from the |
Create an
The content-type of the request data.
Description
Notes
See
The mime-type to use to encode the data.
Description
Notes
See
See
The MIME type name for the newer style of encoding form data, as specified in RFC 1867 and RFC 2388. This style can handle any sort of data, but may not be used in a URL's query string. The data to be used for MIME type comes from
The MIME type name for the older style of encoding form data. Note that this MIME type does not allow for flexible charset use, or for file uploads, but it can be used for the query string in a URL, as long as the amount of data is small. The data to be used for MIME type comes from
The data derived from the
Notes
The data derived from the
Notes