Method HttpClient():new() Foundation

Creates an instance of the HttpClient class.

Syntax
:new( [<cUri>] ) --> oHttpClient
Parameters
<cUri>
A character string with the URI of the server the HTTP client is going to communicate with. This parameter is optional. If no URI is specified in the<cUri> parameter, the URI must be set manually prior to sending the first request to the server.
Return

The class method :new() returns a HttpClient object.

Description

When passing the URI to the :new() method, an instance of the HttpRequestMessage() class is automatically created and assigned to the HTTP client's :httpRequest instance variable. If additional control over the request message and sending the message is required, a developer can create a custom request message instance by passing the URI to the :new() method of the HttpRequestMessage() class. This instance can then be used multiple times with HTTP client objects in :send(), :sendAsync() or :getFile() operations. To gain even more control, developers can subclass from HttpRequestMessage(), spezialize behavior of the class and then pass instances of their own class to the :send() or :sendAsync() method of the HttpClient class.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.