Libraries.Network.NetworkResponseEvent Documentation
This class is returned by the NetworkConnection class in response to a request made over the internet protocol. More information on the internet protocol, called Hyper Text Transfer Protocol (HTTP) can be found at: https://www.w3.org/Protocols/,
Example Code
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
output response:GetResponseText()
end
end
Inherits from: Libraries.Language.Object
Actions Documentation
AddHeader(text name, text value)
This method adds a header to the NetworkResponseEvent as a key value pair. This method is primarily used by the library to populate the fields of the NetworkResponseEvent from the server.
Parameters
- text name: The name of the header.
- text value: The value of the header.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkResponseEvent
action ReturnResponse(NetworkConnection http) returns NetworkResponseEvent
NetworkResponseEvent response = http:GetResponseEvent()
response:AddHeader("User-Agent", "Quorum Client")
return response
end
Compare(Libraries.Language.Object object)
This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Example
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
Example
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
GetContentLength()
This method returns the value of the ContentLength field of the NetworkResponseEvent,
Return
integer: The number of bytes of the ContentLength.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
output response:GetContentLength()
end
end
GetContentType()
This method returns the value of the ContentType field of the NetworkResponseEvent,
Return
text: The type of the content of the NetworkResponseEvent.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
output response:GetContentType()
end
end
GetEncoding()
This method returns the value of the encoding field of the NetworkResponseEvent,
Return
text: The type of encoding of the NetworkResponseEvent.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
output response:GetEncoding()
end
end
GetHashCode()
This action gets the hash code for an object.
Return
integer: The integer hash code of the object.
Example
Object o
integer hash = o:GetHashCode()
GetHeader(text key)
This method returns the a specific header on the NetworkResponseEvent,
Parameters
- text key: The name of the header to return
Return
text: The header for a given key.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
output response:GetHeader("User-Agent")
end
end
GetHeaders()
This method returns a hash table with all the headers on the NetworkResponseEvent,
Return
Libraries.Containers.HashTable: A hash table list of the headers.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
HashTable<text, text> headers = response:GetHeaders()
end
end
GetResponseText()
This method returns the response text of the NetworkResponseEvent,
Return
text: The response text.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
output response:GetResponseText()
end
end
GetStatusCode()
This method returns the status code of the NetworkResponseEvent,
Return
integer: The status text.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
output response:GetStatusCode()
end
end
GetStatusText()
This method returns the status text of the NetworkResponseEvent,
Return
text: The status text.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
output response:GetStatusText()
end
end
GetWebAddress()
This method returns the web address of the NetworkResponseEvent,
Return
text: The web address.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
output response:GetWebAddress()
end
end
IsOk()
This method checks if the status code of a NetworkResponseObject is a success value.
Return
boolean: A boolean value indicating if the status code is a success value.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkRequest
use Libraries.Network.NetworkResponseEvent
use Libraries.Network.NetworkRequestListener
class Main is NetworkRequestListener
action Main
NetworkRequest request
request:SetRequestTypeToGet()
request:SetWebAddress("https://quorumlanguage.com/GETtest.php")
NetworkConnection http
http:AddListener(me)
http:SendRequest(request)
end
action ResponseReceived(NetworkResponseEvent response)
output response:IsOk()
end
end
SetContentLength(integer length)
This method sets the ContentLength of a NetworkResponseEvent. This method is primarily used by the library to populate the fields of the NetworkResponseEvent from the server.
Parameters
- integer length: The length of the content in bytes.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkResponseEvent
action ReturnResponse(NetworkConnection http) returns NetworkResponseEvent
NetworkResponseEvent response = http:GetResponseEvent()
response:SetContentLength(120)
return response
end
SetContentType(text contentType)
This method sets the ContentType of a NetworkResponseEvent. This method is primarily used by the library to populate the fields of the NetworkResponseEvent from the server.
Parameters
- text contentType: The http Content-Type value.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkResponseEvent
action ReturnResponse(NetworkConnection http) returns NetworkResponseEvent
NetworkResponseEvent response = http:GetResponseEvent()
response:SetContentType("text/html; charset=utf-8")
return response
end
SetEncoding(text encoding)
This method sets the encoding of a NetworkResponseEvent. This method is primarily used by the library to populate the fields of the NetworkResponseEvent from the server.
Parameters
- text encoding: The http Content-Encoding value.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkResponseEvent
action ReturnResponse(NetworkConnection http) returns NetworkResponseEvent
NetworkResponseEvent response = http:GetResponseEvent()
response:SetEncoding("gzip")
return response
end
SetResponseText(text responseText)
This method sets the response text of a NetworkResponseEvent. This method is primarily used by the library to populate the fields of the NetworkResponseEvent from the server.
Parameters
- text responseText: The response text.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkResponseEvent
action ReturnResponse(NetworkConnection http) returns NetworkResponseEvent
NetworkResponseEvent response = http:GetResponseEvent()
response:SetResponseText("Hello World!")
return response
end
SetStatusCode(integer statusCode)
This method sets the status text of a NetworkResponseEvent. This method is primarily used by the library to populate the fields of the NetworkResponseEvent from the server.
Parameters
- integer statusCode: The status code of the response from the http specification.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkResponseEvent
action ReturnResponse(NetworkConnection http) returns NetworkResponseEvent
NetworkResponseEvent response = http:GetResponseEvent()
response:SetStatusCode(200)
return response
end
SetStatusText(text statusText)
This method sets the status text of a NetworkResponseEvent. This method is primarily used by the library to populate the fields of the NetworkResponseEvent from the server.
Parameters
- text statusText: The status text corresponding to the status code accoding to the http specification.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkResponseEvent
action ReturnResponse(NetworkConnection http) returns NetworkResponseEvent
NetworkResponseEvent response = http:GetResponseEvent()
response:SetStatusText("OK")
return response
end
SetWebAddress(text webAddress)
This method sets the web address of a NetworkResponseEvent. This method is primarily used by the library to populate the fields of the NetworkResponseEvent from the server.
Parameters
- text webAddress: The web address of the responding server.
Example
use Libraries.Network.NetworkConnection
use Libraries.Network.NetworkResponseEvent
action ReturnResponse(NetworkConnection http) returns NetworkResponseEvent
NetworkResponseEvent response = http:GetResponseEvent()
response:SetWebAddress("quorumlanguage.com)
return response
end
On this page
Variables TableAction Documentation- AddHeader(text name, text value)
- Compare(Libraries.Language.Object object)
- Equals(Libraries.Language.Object object)
- GetContentLength()
- GetContentType()
- GetEncoding()
- GetHashCode()
- GetHeader(text key)
- GetHeaders()
- GetResponseText()
- GetStatusCode()
- GetStatusText()
- GetWebAddress()
- IsOk()
- SetContentLength(integer length)
- SetContentType(text contentType)
- SetEncoding(text encoding)
- SetResponseText(text responseText)
- SetStatusCode(integer statusCode)
- SetStatusText(text statusText)
- SetWebAddress(text webAddress)