Multipart Form Data Encoding Server-Side Support

The multipart/form‑data is a content type, defined by https://www.ietf.org/rfc/rfc2388.txt, used for POST requests. It is typically used when uploading the contents of files that may be very large and have special characters or be in binary format.

In a multipart/form-data request, the HTTP body is separated into multiple parts, with each part containing some information about the file or data, the data itself, then a delimiter prefixed with two dash characters.

--9051914041544843365972754266
Content-Disposition: form-data; name="text"

text default
--9051914041544843365972754266
Content-Disposition: form-data; name="file1"; filename="a.txt"
Content-Type: text/plain

Content of a.txt.

--9051914041544843365972754266
Content-Disposition: form-data; name="file2"; filename="a.html"
Content-Type: text/html
<!DOCTYPE html><title>Content of a.html.</title>

--9051914041544843365972754266--

The delimiter is specified in the Content-Type HTTP header after multipart/form-data, and prefixed with boundary=; for example:

Content-Type: multipart/form-data; boundary=9051914041544843365972754266

Server-Side Support

In releases prior to Jade 2022, Jade automatically converted the multipart/form‑data body into url/form‑encoded, where each bit of form data was separated by an ampersand character (&) and the boundaries, Content‑Disposition, and Content‑Type information were removed. In addition, this data was not sent through to the Jade REST method as parameters, so it relied on user code to extract it from the body (for example, by reimplementing the JadeRestService class processRequest method).

In Jade 2022, Jade provides the option to leave the HTTP body as it is and send the data through to the Jade REST method as parameters. By default, the existing behavior of earlier releases is maintained. To enable the multipart form data encoding that extracts the data into parameters, it must be explicitly enabled by setting the value of the UseNewStyleMultipart parameter to true in the jadehttp.ini file under the application for your web service; for example:

[JadeDefaultApp]
TcpConnection=localhost
TcpPort=6124
ApplicationType=RestServices
MessageTimeout=5
MinInUse=1
MaxInUse=1000
MaxMessageSize=1000000
MinMessageSize=10
UseNewStyleMultipart=true
PurgeDirectoryRule=default
PurgeFileAge=default
VirtualDirectory=

When the UseNewStyleMultipart parameter is not set to true, not only will the data not be extracted to parameters but the behavior in earlier releases of converting the body is also preserved.

2022.0.01 and higher