Http.Request
Description
A class for creating a Http Request.
Properties
data | Gets/sets the data being sent with the request. |
failCallback | Specify the fail callback treenode. |
headers | Gets/sets the headers being sent with the request. |
host | Gets/sets the host. |
labelProperties | Use your own named properties to get/set label values. |
method | Specify the request Http.Method. |
path | Gets/sets the resource path. |
port | Gets/sets the port the request is being sent to. |
statusCallback | Specify the status callback treenode. |
successCallback | Specify the success callback treenode. |
timeout | Specify the request timeout in ms. |
useSSL | Specify whether to use SSL if applicable. |
Methods
send | Send an asynchronous Http request. |
sendAndWait | Send a synchronous Http request. |
Constructor
Http.Request | Creates a Http.Request based on the given url. |
Details
Http.Request.data
string data
Description
Gets/sets the data being sent with the request.
Http.Request request;
request.host = "www.flexsim.com";
request.data = "name1=value1";
Http.Request.failCallback
treenode failCallback
Description
Specify the fail callback treenode.
Http.Request request;
request.host = "www.flexsim.com";
request.failCallback = Model.find("Tools/failCallback");
Http.Request.headers
string headers
Description
Gets/sets the headers being sent with the request.
If this property is not set, then "Content-Type: application/x-www-form-urlencoded\r\n" will be passed as the headers.
Http.Request request;
request.host = "127.0.0.1";
request.port = 5000;
request.path = "/v1/prediction";
request.data = JSON.stringify(observation);
request.headers = "Content-Type: application/json\r\n";
Http.Request.host
string host
Description
Gets/sets the host.
Http.Request request;
request.host = "www.flexsim.com";
Http.Request.labelProperties
Variant labelProperties
Description
Use your own named properties to get/set label values.
Custom properties added to Http.Request objects will be accessible with the same name on Http.Response objects created in callbacks and the return value of sendAndWait().
Http.Request request = Http.Request("https://www.flexsim.com/");
request.statusCallback = Model.find("Tools/statusCallback");
request.myProcessor = Model.find("Processor1");
Http.Response response = request.sendAndWait();
print(response.myProcessor); // /Processor1
Http.Request.method
int method
Description
Specify the request Http.Method.
Http.Request request;
request.host = "www.flexsim.com";
request.method = Http.Method.Get;
Http.Request.path
string path
Description
Gets/sets the resource path.
Http.Request request;
request.host = "www.flexsim.com";
request.path = "flexsim";
Http.Request.port
int port
Description
Gets/sets the port the request is being sent to.
Http.Request request;
request.host = "www.flexsim.com";
request.port = 443;
Http.Request.statusCallback
treenode statusCallback
Description
Specify the status callback treenode.
Http.Request request;
request.host = "www.flexsim.com";
request.statusCallback = Model.find("Tools/statusCallback");
Http.Request.successCallback
treenode successCallback
Description
Specify the success callback treenode.
Http.Request request;
request.host = "www.flexsim.com";
request.successCallback = Model.find("Tools/successCallback");
Http.Request.timeout
int timeout
Description
Specify the request timeout in ms.
Http.Request request;
request.host = "www.flexsim.com";
request.timeout = 1000; // 1 second timeout
Http.Request.useSSL
int useSSL
Description
Specify whether to use SSL if applicable.
Http.Request request;
request.host = "www.flexsim.com";
request.useSSL = 1;
Http.Request.send()
void send( ) |
Description
Send an asynchronous Http request.
Http.Request request;
request.host = "www.flexsim.com";
request.port = 443;
request.useSSL = 1;
request.successCallback = Model.find("Tools/successCallback");
request.send();
Http.Request.sendAndWait()
Http.Response sendAndWait( ) |
Description
Send a synchronous Http request.
Http.Request request;
request.host = "www.flexsim.com";
request.port = 443;
request.useSSL = 1;
request.status = Model.find("Tools/statusCallback");
Http.Response response = request.sendAndWait();
Http.Request Constructor
Http.Request( string URL ) |
Parameters
URL | A URL specifying the host, and can include the protocol(Http/Https), the port, and the reference path. |
Returns
Http.Request | A Http.Request |
Description
Creates a Http.Request based on the given url.
Http.Request request = Http.Request("https://www.flexsim.com:443/flexsim/");