NetReplyEventclass
Network Reply event. This type of event occurs when we receive a reply to a network request made with sendNetRequest().
class
NetReplyEvent
:
NetEvent
Superclass Tree (in declaration order)
NetReplyEvent
NetEvent
` object`
Subclass Tree
(none)
Global Objects
(none)
Summary of Properties
evType
httpStatusLine
redirectLoc
replyBody
replyHeaders
replyHeadersRaw
requestID
statusCode
Inherited from NetEvent
:
evArgs
Summary of Methods
Properties
evType
OVERRIDDEN
our default event type is NetEvReply
httpStatusLine
the HTTP status string (the first line of the headers)
redirectLoc
Redirect location, if applicable. By default, this will be nil whether or not a redirection took place, because sendNetRequest() normally follows redirection links transparently, returning only the final result from the final server we’re redirected to. However, you can override automatic redirection with an option flag (NetReqNoRedirect) when calling sendNetRequest(). When that option is selected, the function won’t follow redirection links at all, but will instead simply return the redirect information as the result from the request. When that happens, this property is set to a string giving the target of the redirect. You can then follow the redirect manually, if desired, by sending a new request to the target given here.
replyBody
the content body from the reply
replyHeaders
the HTTP headers from the reply, as a lookup table indexed by header name
replyHeadersRaw
the HTTP headers from the reply, in the raw text format - this is simply a string of all the headers, separated by CR-LF (\r\n) sequences
requestID
The request identifier. This is the ID value provided by the caller in the call to sendNetRequest(), so that the caller can relate the reply back to the corresponding request.
statusCode
The network status code. This is an integer value indicating whether the request was successful or failed with an error. A negative value is a low-level TADS error indicating that the request couldn’t be sent to the server, or that a network error occurred receiving the reply:
-1 - out of memory
-2 - couldn’t connect to host
-3 - other network/socket error
-4 - invalid parameters
-5 - error reading the content data to send to the server
-6 - error saving the reply data received from the server
-7 - error retrieving reply headers
-8 - error starting background thread
-100 - other TADS/network error
A positive value means that the network transaction itself was successful, and reflects the status information returned by the network server that handled the request. This must be interpreted according to the protocol used to send the request:
- For HTTP requests, the value is an HTTP status code. A code in the 200 range generally indicates success, while other ranges generally indicate errors.
Methods
construct (t, id, status, body, headers, loc)
OVERRIDDEN
construction
TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3