Table of Contents

Table of Contents

FlexScript Class - Http.Response

Http.Response

Description

A class representing the Response to a Http Request.

Properties

data Gets the data sent with the request.
failCallback Gets the fail callback treenode.
host Gets the host used in the request.
labelProperties Use your own named properties to get/set label values.
method Gets the request Http.Method used in the request.
path Gets the resource path used in the request.
port Gets the port the request was sent to.
receivedBytes Gets the amount of bytes of the response message received.
statusCallback Gets the status callback treenode.
statusCode Gets the request's Http status code.
successCallback Gets the success callback treenode.
timeout Gets the request timeout in ms used in the request.
totalBytes Gets the size of the response message in bytes.
useSSL Gets whether SSL was used in the request.
value Gets the response message ot the Http request.

Methods

saveToFile Saves the Http.Response value to a file.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.data

readonly string data

Description

Gets the data sent with the request.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.failCallback

readonly treenode failCallback

Description

Gets the fail callback treenode.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.host

readonly string host

Description

Gets the host used in the request.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.labelProperties

readonly Variant labelProperties

Description

Use your own named properties to get/set label values.

custom labels on Http.Response objects are inherited from the Http.Request object.


			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
			
Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.method

readonly int method

Description

Gets the request Http.Method used in the request.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.path

readonly string path

Description

Gets the resource path used in the request.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.port

readonly int port

Description

Gets the port the request was sent to.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.receivedBytes

readonly int receivedBytes

Description

Gets the amount of bytes of the response message received.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.statusCallback

readonly treenode statusCallback

Description

Gets the status callback treenode.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.statusCode

readonly int statusCode

Description

Gets the request's Http status code.


			Http.Request request = Http.Request("https://www.flexsim.com/");
			request.statusCallback = Model.find("Tools/statusCallback");
			request.myProcessor = Model.find("Processor1");
			request.sendAndWait();
			//In the statusCallback node//
			Http.Response response = param(1);
			print(response.statusCode); // last print should be a 200
			
Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.successCallback

readonly treenode successCallback

Description

Gets the success callback treenode.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.timeout

readonly int timeout

Description

Gets the request timeout in ms used in the request.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.totalBytes

readonly int totalBytes

Description

Gets the size of the response message in bytes.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.useSSL

readonly int useSSL

Description

Gets whether SSL was used in the request.

Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.value

readonly string value

Description

Gets the response message ot the Http request.


			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.value); //prints the response message
			
Do no remove, this fixes the anchor on doc.flexsim.com

Http.Response.saveToFile()

void saveToFile( string filePath )

Description

Saves the Http.Response value to a file.


			Http.Request request;
			request.host = "www.flexsim.com";
			request.port = 443;
			request.useSSL = 1;
			request.successCallback = Model.find("Tools/successCallback");
			Http.Response response = request.sendAndWait();
			response.saveToFile(modeldir() + "flexsim_homepage.html");