Class: CommonServiceBase

SuperMap.CommonServiceBase

The base service class to dock iServer services.

new SuperMap.CommonServiceBase(url, options)

CommonServiceBase.js, line 29
Name Type Description
url string

The service url.

options Object

The parameters.

Name Type Default Description
eventListeners Object

The object of listening. The processCompleted property can be passed into the callback function after the processing is completed. The processFailed property can be passed into the callback function after the processing is failed.

proxy string optional

The address of the service agent.

serverType SuperMap.ServerType SuperMap.ServerType.ISERVER optional

The server type. iServer|iPortal|Online.

withCredentials boolean false optional

Request whether to carry a cookie.

format SuperMap.DataFormat SuperMap.DataFormat.GEOJSON optional

The format of query result. It currently supports iServerJSON and GeoJSON. The parameter formats are "ISERVER" and "GEOJSON".

crossOrigin boolean optional

Whether to allow cross-domain requests.

headers Object optional

Request header.

Methods

ajaxPolling()

CommonServiceBase.js, line 250

If the number of remaining requests failed is not 0 after the request fails, recapture the url and send request.

calculatePollingTimes()

CommonServiceBase.js, line 268

Calculate how many times the remaining request failed.

destroy()

CommonServiceBase.js, line 118

Dispose the resource. Properties of referenced resources are set to null.

getCredential(url){SuperMap.Credential}

CommonServiceBase.js, line 192

Get credential information.

Name Type Description
url string

The service url.

Returns:
Type Description
SuperMap.Credential The credential information object.

getUrlCompleted(result)

CommonServiceBase.js, line 223

Execute this method after the request is successful.

Name Type Description
result Object

The result object returned by the server side.

getUrlFailed(result)

CommonServiceBase.js, line 234

Execute this method after the request is failed.

Name Type Description
result Object

The result object returned by the server side.

isServiceSupportPolling()

CommonServiceBase.js, line 295

Judge whether the service supports polling.

request(options)

CommonServiceBase.js, line 146
Name Type Description
options Object

Optional parameters.

Name Type Default Description
method string 'GET' optional

Request method, including: "GET","POST","PUT","DELETE".

url string optional

The request URL.

params Object optional

The params are only applicable to the request sent by the GET method as a set of key value pairs added to the URL by query string.

data string optional

The data sent to the server.

success function

The callback function after the success request.

failure function

The callback function after the failure request.

scope Object optional

If the callback function is a common method of the object, set the scope of the object.

isInTheSameDomain boolean optional

Whether the request is in the current domain.

withCredentials boolean false optional

Request whether to carry a cookie.

serviceProcessCompleted(result)

CommonServiceBase.js, line 307

Execute this method if process completed.

Name Type Description
result Object

The result object returned by the server side.

serviceProcessFailed(result)

CommonServiceBase.js, line 319

Execute this method if process failed.

Name Type Description
result Object

The result object returned by the server side.