$k. HttpConnection

new HttpConnection()

A single connection to a HTTP server.

Extends

Methods

asyncRequest(request)

Sends the requests in an asynchronous manner. Neither waits for sending the request nor for receiving the response. Check the log file for errors (channel "javascript").

Parameters:
NameTypeDescription
request$k.HttpRequest
Since
  • 5.2.2
Throws:

If the URI is not allowed

Type
URIError

authenticate(username, password)

Set the username and password

Parameters:
NameTypeDescription
usernamestring
passwordstring
Since
  • 4.0.3

authenticateFromEncrypedAccount(encryptedAccount)

Set the username and password from a volume encrypted authenication string

Parameters:
NameTypeDescription
encryptedAccountstring

Encrypted account (Base64 encoded string generated in the Admin-Tool)

Since
  • 5.2.1

getResponse(request) → {$k.HttpResponse}

Sends the requests and returns a reponse

Parameters:
NameTypeDescription
request$k.HttpRequest
Deprecated
  • Use request()
Throws:
Returns:

The response for the request

Type: 
$k.HttpResponse

proxyUseNegotiate()

Use negotiate mechanism for authentication with the proxy

Since
  • 5.3.2

request(request) → {$k.HttpResponse}

Sends the requests and returns a reponse

Only HTTP(S) requests are allowed. If the URI uses another protocol (e.g. 'file'), then an URIError is raised.

It is possible to restrict the domains that can be accessed by adding the following to the configuration file of a client (bridge etc.):


[script]
allowedOutgoingDomains=*.intelligent-views.com,ivinternal:8080
Parameters:
NameTypeDescription
request$k.HttpRequest
Since
  • 5.3
Throws:
Returns:

The response for the request

Type: 
$k.HttpResponse

setProxy(hostopt, portopt, typeopt, credentialsopt)

Set the proxy data to use for this connection: host, port, type, credentials

Parameters:
NameTypeAttributesDescription
hoststring<optional>

name of the proxy host, if omitted deactivates proxy

portnumber<optional>

port of the proxy, default 3128

typestring<optional>

type of the proxy http/https, default "http"

credentialsstring<optional>

encrypted account (base64 encoded string generated in the Admin-Tool)

Since
  • 5.3.2
Throws:

An argument has an invalid value

Type
$k.exception.InvalidValue

setTimeout(timeout)

Set the timeout in milliseconds for connection to wait for reponses

Parameters:
NameTypeDescription
timeoutnumber

number of milliseconds to wait for reponses, default 20000

Since
  • 4.2.0

useNegotiate()

Use negotiate mechanism for authentication

Since
  • 5.2.2