Skip to content

Properties

The HttpRequest object contains the following properties.

backgroundTransfer Property


Enables HTTP request calls in the background.
This property is only available on the iOS platform.

Syntax


httpClient.backgroundTransfer

Type

Boolean

Read/Write

Read only

Remarks

The default value for the backgroundTransfer property is false.

Note: The iOS platform internally retries to keep the request connected until it reaches the timeoutIntervalForResource value, which may cause duplicate transactions to occur on the system. Hence, HCL recommends that you use the backgroundTransfer property only for GET calls.


integrityStatus Property


Contains the status of the integrity check, if integrity checking is enabled.

Syntax


integrityStatus

Type

Constant. Can be one of the following values.

Constant Description
constants.HTTP_INTEGRITY_CHECK_FAILED The integrity check has failed.
constants.HTTP_INTEGRITY_CHECK_NOT_DONE The response has not yet been received, or integrity checking is not enabled, so the integrityStatus property has not yet been populated.
constants.HTTP_INTEGRITY_CHECK_SUCCESSFUL The integrity check was successful.

Read/Write

Read only

Remarks

If the validateResp argument in the propertiesTable parameter of the voltmx.net.setIntegrtityCheck function is set to true, then integrity checking is performed on the HTTP responses that your client app exchanges with the server app. For more information on integrity checking, please see HTTP Integrity Checking.


readyState Property


Holds the current status of the HttpRequest object

Syntax


readyState

Type

Number

Read/Write

Read only

Remarks

The possible values of the readyState property are as follows.

ConstantValueDescription
constants.HTTP_READY_STATE_UNSENT0The object has been constructed.
constants.HTTP_READY_STATE_OPENED1The open method has been successfully invoked.
constants.HTTP_READY_STATE_HEADERS_RECEIVED2All redirects have been followed and all HTTP headers of the final response have been received.
constants.HTTP_READY_STATE_LOADING3The response data has been received.
constants.HTTP_READY_STATE_DONE4The data transfer has been completed or something went wrong during transfer.

response Property


Contains the HTTP response.

Syntax


httpRequest.response

Type

String

Read/Write

Read only

Remarks

After the response has been received, this property contains the response body. The type of the value depends on the value of the responseType property.

If responseType is constants.HTTP_RESPONSE_TYPE_TEXT, then the response value is a response string.

If responseType is constants.HTTP_RESPONSE_TYPE_JSON, then the response value is a whatever is returned by the Json.parse() function when it is passed the response content.

If responseType is constants.HTTP_RESPONSE_TYPE_DOCUMENT, then the response value is an XML string.

If responseType is constants.HTTP_RESPONSE_TYPE_RAWDATA, then the response value is a platform-specific handle representing the raw data of binary content of type voltmx.types.RawBytes.

Note: For JSON type, if JSON parse fails, null is returned. For DOCUMENT type, native platforms do not perform any validations on the response.

In the case where an exception is thrown, this property contains empty string.


responseType Property


Contains the type of the HTTP response.

Syntax


httpRequest.responseType

Type

String

Read/Write

Read only

Remarks

Holds the response type when the response arrives. By default, it is empty string until the response is received. The possible values are:

  • constants.HTTP_RESPONSE_TYPE_TEXT
  • constants.HTTP_RESPONSE_TYPE_JSON
  • constants.HTTP_RESPONSE_TYPE_DOCUMENT
  • constants.HTTP_RESPONSE_TYPE_RAWDATA

Note: The RAWDATA type is not supported by SPA .


status Property


Holds the HTTP status code.

Syntax


httpRequest.status

Type

Number

Read/Write

Read only

Remarks

Contains the HTTP status code, which is 0 if the status of the request is not sent; that is, the send function is still not invoked on this object.


statusText Property


Holds a text message describing the status of the HTTP request.

Syntax


httpRequest.statusText

Type

String

Read/Write

Read only

Remarks

Contains the HTTP reason phrase of the status line, which is an empty string, if the status of the request is not sent; that is, the send function is still not invoked on this object. The reason phrase for a given status code is based on the http specification (RFC 2616). However, these phrases are only recommendations and may vary with other equivalent phrases by individual platform implementations.


timeout Property


Controls the HTTP request timeout value.

Syntax


httpRequest.timeout

Type

Number

Read/Write

Read + Write

Remarks

The time in milliseconds a request can take before being terminated. By default, the value is zero, which means that there is no timeout set, or that the timeout is set to infinite. This timeout represents the connection timeout and the response timeout from the server.

Note: On the iOS platform, the default value for the timeout property is 60 seconds. Further, the timeout property is only applicable for requests in the foreground, i.e, the backgroundTransfer parameter is not enabled in the HTTP request object.