Route Properties
Properties on route classes are populated with data from the URL query string for GET requests, and from form data for POST requests. Properties are populated based on parameters or input fields with matching names.
Only public properties are populated, which allows you to safely define protected and read‑only properties on your class without the potential for web requests to set their values.
Web clients can send any values in HTTP requests. Just because your HTML form does not define an input field with a specified name does not mean a web client cannot forge a request with arbitrary field names. You should expect that any public property on a route class can be overwritten by the web client.
The following attribute types are supported.
-
Binary. The attribute is directly populated by the raw binary received from the web client.
-
Boolean. This attribute is true if any value (including an empty string and any other possible value) is sent with this name. This attribute is only ever false if no field with a matching name is present in the request. It is expected Boolean properties to be used only to represent radio buttons and check boxes and to be true if the radio button or check box is selected; otherwise it is false.
-
Date. The sent string value is converted to a Date type. An HTML <input type="date"> sends a formatted string that is represented correctly in Jade. If the sent value cannot be converted to a valid Date, the value is equivalent to null.
-
Decimal. The sent string value is converted to a Decimal.
-
Integer. The UTF‑8 binary received from the web client is converted into a native String and then converted to an Integer. The semantics of this conversion are the same as casting a String type to an Integer.
-
Integer64. The UTF‑8 binary received from the web client is converted into a native String and then converted to an Integer64. The semantics of this conversion are the same as casting a String type to an Integer64.
-
Real. The sent string value is converted to a Real.
-
String. The UTF‑8 binary received from the web client is converted into a native String type.
-
StringUtf8. The UTF‑8 binary received from the web client is converted into a StringUtf8 type.
-
Time. The sent string value is converted to a Time type. An HTML <input type="time"> sends a formatted string that is represented correctly in Jade. If the sent value cannot be converted to a valid Time, the value is equivalent to null.
-
TimeStamp. The sent string value is parsed and converted to a TimeStamp type. An HTML <input type="datetime-local"> sends a formatted string that can be parsed and converted correctly. If the sent value cannot be parsed and converted to a valid TimeStamp, the value is equivalent to null.
-
StringArray. The UTF‑8 binary receives from the web client is converted to a native String type, and the value is added to the array. Multiple parameters or input fields with the same name add additional entries to the array. The StringArray must be an embedded attribute on the route class, not an object reference.
-
StringUtf8Array. Same as StringArray but the conversion is to a StringUtf8.
Special handling for file input fields
If form data contains file information, such as from an HTML <input type="file">, a temporary file representing this file is created. A String property is populated with a string in the following format.
original_filename.ext;C:\path\to\temporary\file
For example, somename.png;C:\temp\35283f1f-d4d2-456a-b141-ea50054e4e10.
This string can be parsed by the application by treating everything up to the first semicolon character (;) as the file name that was sent by the request, and everything following as the path to the temporary file.
The temporary file is deleted after the HTTP request ends. The application must read or copy the file during the request to retain it.
A StringArray property is populated with multiple of these file‑format strings, in the case of an upload containing multiple files.
