ConnectionManager Class
Creates an instance of connection manager object
Constructor
ConnectionManager
-
endPointUrl
-
authenticationAgent
-
connectionFactory
-
[siteAccess]
Parameters:
-
endPointUrl
Stringurl to REST root
-
authenticationAgent
ObjectInstance of one of the AuthAgents (e.g. SessionAuthAgent, HttpBasicAuthAgent)
-
connectionFactory
ConnectionFeatureFactorythe factory which is choosing compatible connection from connections list
-
[siteAccess]
String optionalSiteAccess to use for requests
Item Index
Methods
Methods
notAuthorizedRequest
-
[method="GET"]
-
[url="/"]
-
[body=""]
-
[headers]
-
callback
Not authorized request function Used mainly for initial requests (e.g. createSession)
Parameters:
-
[method="GET"]
String optionalrequest method ("POST", "GET" etc)
-
[url="/"]
String optionalrequested REST resource
-
[body=""]
String optionala string which should be passed in request body to the REST service
-
[headers]
Object optional{object} object literal describing request headers
-
callback
Functionfunction, which will be executed on request success
request
-
[method="GET"]
-
[url="/"]
-
[body=""]
-
[headers]
-
[requestEventHandlers]
-
callback
Basic request function
Parameters:
-
[method="GET"]
String optionalrequest method ("POST", "GET" etc)
-
[url="/"]
String optionalrequested REST resource
-
[body=""]
String optionala string which should be passed in request body to the REST service
-
[headers]
Object optional{object} object literal describing request headers
-
[requestEventHandlers]
Object optionala set of callbacks to apply on a specific XHR event like onload, onerror, onprogress, etc.
-
callback
Functionfunction, which will be executed on request success
Example:
var connectionManager = jsCAPI.getConnectionManager();
connectionManager.request(
'GET',
'/endpoint',
'',
{Accept: 'application/json'},
{
upload: {
onloadstart: someUploadCallback,
onload: someUploadCallback,
onloadend: someUploadCallback,
onprogress: someUploadCallback,
onabort: someUploadCallback,
onerror: someUploadCallback,
ontimeout: someUploadCallback,
},
onloadstart: someCallback,
onload: someCallback,
onloadend: someCallback,
onprogress: someCallback,
onabort: someCallback,
onerror: someCallback,
ontimeout: someCallback,
},
callback
);