| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e71532a commit 0969442
174 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,6 @@ export class AddressMatchService extends CommonServiceBase { | |||
| 35 | 35 | proxy: me.proxy, | |
| 36 | 36 | withCredentials: me.withCredentials, | |
| 37 | 37 | crossOrigin: me.crossOrigin, | |
| 38 | - serverType: me.serverType, | ||
| 39 | 38 | eventListeners: { | |
| 40 | 39 | scope: me, | |
| 41 | 40 | processCompleted: callback, | |
@@ -58,7 +57,6 @@ export class AddressMatchService extends CommonServiceBase { | |||
| 58 | 57 | proxy: me.proxy, | |
| 59 | 58 | withCredentials: me.withCredentials, | |
| 60 | 59 | crossOrigin: me.crossOrigin, | |
| 61 | - serverType: me.serverType, | ||
| 62 | 60 | eventListeners: { | |
| 63 | 61 | scope: me, | |
| 64 | 62 | processCompleted: callback, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,7 +45,6 @@ export class DatasetService extends CommonServiceBase { | |||
| 45 | 45 | withCredentials: me.withCredentials, | |
| 46 | 46 | crossOrigin: me.crossOrigin, | |
| 47 | 47 | headers: me.headers, | |
| 48 | - serverType: me.serverType, | ||
| 49 | 48 | eventListeners: { | |
| 50 | 49 | scope: me, | |
| 51 | 50 | processCompleted: callback, | |
@@ -76,7 +75,6 @@ export class DatasetService extends CommonServiceBase { | |||
| 76 | 75 | withCredentials: me.withCredentials, | |
| 77 | 76 | crossOrigin: me.crossOrigin, | |
| 78 | 77 | headers: me.headers, | |
| 79 | - serverType: me.serverType, | ||
| 80 | 78 | eventListeners: { | |
| 81 | 79 | scope: me, | |
| 82 | 80 | processCompleted: callback, | |
@@ -122,7 +120,6 @@ export class DatasetService extends CommonServiceBase { | |||
| 122 | 120 | withCredentials: me.withCredentials, | |
| 123 | 121 | crossOrigin: me.crossOrigin, | |
| 124 | 122 | headers: me.headers, | |
| 125 | - serverType: me.serverType, | ||
| 126 | 123 | eventListeners: { | |
| 127 | 124 | processCompleted: callback, | |
| 128 | 125 | processFailed: callback | |
@@ -150,7 +147,6 @@ export class DatasetService extends CommonServiceBase { | |||
| 150 | 147 | withCredentials: me.withCredentials, | |
| 151 | 148 | crossOrigin: me.crossOrigin, | |
| 152 | 149 | headers: me.headers, | |
| 153 | - serverType: me.serverType, | ||
| 154 | 150 | eventListeners: { | |
| 155 | 151 | processCompleted: callback, | |
| 156 | 152 | processFailed: callback | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,7 +40,6 @@ export class DatasourceService extends CommonServiceBase { | |||
| 40 | 40 | withCredentials: me.withCredentials, | |
| 41 | 41 | crossOrigin: me.crossOrigin, | |
| 42 | 42 | headers: me.headers, | |
| 43 | - serverType: me.serverType, | ||
| 44 | 43 | eventListeners: { | |
| 45 | 44 | scope: me, | |
| 46 | 45 | processCompleted: callback, | |
@@ -70,7 +69,6 @@ export class DatasourceService extends CommonServiceBase { | |||
| 70 | 69 | withCredentials: me.withCredentials, | |
| 71 | 70 | crossOrigin: me.crossOrigin, | |
| 72 | 71 | headers: me.headers, | |
| 73 | - serverType: me.serverType, | ||
| 74 | 72 | eventListeners: { | |
| 75 | 73 | scope: me, | |
| 76 | 74 | processCompleted: callback, | |
@@ -106,7 +104,6 @@ export class DatasourceService extends CommonServiceBase { | |||
| 106 | 104 | withCredentials: me.withCredentials, | |
| 107 | 105 | crossOrigin: me.crossOrigin, | |
| 108 | 106 | headers: me.headers, | |
| 109 | - serverType: me.serverType, | ||
| 110 | 107 | eventListeners: { | |
| 111 | 108 | processCompleted: callback, | |
| 112 | 109 | processFailed: callback | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,9 +2,7 @@ | |||
| 2 | 2 | * This program are made available under the terms of the Apache License, Version 2.0 | |
| 3 | 3 | * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ | |
| 4 | 4 | import { SuperMap } from '../SuperMap'; | |
| 5 | - import { ServerType } from '../REST'; | ||
| 6 | 5 | import { SecurityManager } from '../security/SecurityManager'; | |
| 7 | - import { Credential } from '../commontypes/Credential'; | ||
| 8 | 6 | import { FetchRequest } from '../util/FetchRequest'; | |
| 9 | 7 | ||
| 10 | 8 | /** | |
@@ -22,7 +20,6 @@ export class IPortalServiceBase { | |||
| 22 | 20 | constructor(url, options) { | |
| 23 | 21 | options = options || {}; | |
| 24 | 22 | this.serviceUrl = url; | |
| 25 | - this.serverType = ServerType.iPortal; | ||
| 26 | 23 | this.CLASS_NAME = "SuperMap.iPortalServiceBase"; | |
| 27 | 24 | this.withCredentials = options.withCredentials || false; | |
| 28 | 25 | this.crossOrigin = options.crossOrigin | |
@@ -40,67 +37,12 @@ export class IPortalServiceBase { | |||
| 40 | 37 | */ | |
| 41 | 38 | ||
| 42 | 39 | request(method, url, param, requestOptions = {headers: this.headers, crossOrigin: this.crossOrigin, withCredentials: this.withCredentials }) { | |
| 43 | - url = this.createCredentialUrl(url); | ||
| 40 | + url = SecurityManager.appendCredential(url); | ||
| 44 | 41 | return FetchRequest.commit(method, url, param, requestOptions).then(function (response) { | |
| 45 | 42 | return response.json(); | |
| 46 | 43 | }); | |
| 47 | 44 | } | |
| 48 | - | ||
| 49 | - | ||
| 50 | - /** | ||
| 51 | - * @function SuperMap.iPortalServiceBase.prototype.createCredentialUrl | ||
| 52 | - * @description 追加授权信息。 | ||
| 53 | - * @param {string} url - 创建证书 URL 地址。 | ||
| 54 | - * @returns {string} 携带 token 或 key 的新地址。 | ||
| 55 | - */ | ||
| 56 | - | ||
| 57 | - createCredentialUrl(url) { | ||
| 58 | - var newUrl = url, | ||
| 59 | - credential = this.getCredential(); | ||
| 60 | - | ||
| 61 | - if (credential) { | ||
| 62 | - var endStr = newUrl.substring(newUrl.length - 1, newUrl.length); | ||
| 63 | - | ||
| 64 | - if (newUrl.indexOf("?") > -1 && endStr === "?") { | ||
| 65 | - newUrl += credential.getUrlParameters(); | ||
| 66 | - } else if (newUrl.indexOf("?") > -1 && endStr !== "?") { | ||
| 67 | - newUrl += "&" + credential.getUrlParameters(); | ||
| 68 | - } else { | ||
| 69 | - newUrl += "?" + credential.getUrlParameters(); | ||
| 70 | - } | ||
| 71 | - } | ||
| 72 | - return newUrl; | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - | ||
| 76 | - /** | ||
| 77 | - * @function SuperMap.iPortalServiceBase.prototype.getCredential | ||
| 78 | - * @description 获取 token。 | ||
| 79 | - * @returns {string} 返回获取的 token。 | ||
| 80 | - * | ||
| 81 | - */ | ||
| 82 | - | ||
| 83 | - getCredential() { | ||
| 84 | - var credential, | ||
| 85 | - value = SecurityManager.getToken(this.serviceUrl); | ||
| 86 | - credential = value ? new Credential(value, "token") : null; | ||
| 87 | - if (!credential) { | ||
| 88 | - value = this.getKey(); | ||
| 89 | - credential = value ? new Credential(value, "key") : null; | ||
| 90 | - } | ||
| 91 | - return credential; | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - | ||
| 95 | - /** | ||
| 96 | - * @function SuperMap.iPortalServiceBase.prototype.getKey | ||
| 97 | - * @description 其子类需要重写该方法,修改其中获取 key 的字段,存储 key 可能是服务 ID 字段,可能是 URL。 | ||
| 98 | - */ | ||
| 99 | - getKey() { | ||
| 100 | - //return SuperMap.SecurityManager.getKey(this.id); | ||
| 101 | - //或 | ||
| 102 | - //return SuperMap.SecurityManager.getKey(this.serviceUrl); | ||
| 103 | - } | ||
| 45 | + | ||
| 104 | 46 | ||
| 105 | 47 | } | |
| 106 | 48 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,6 @@ import {CommonServiceBase} from './CommonServiceBase'; | |||
| 18 | 18 | * 发送请求格式类似于:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图/chartFeatureInfoSpecs.json"。 | |
| 19 | 19 | * @param {Object} options - 参数。 | |
| 20 | 20 | * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。 | |
| 21 | - * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。 | ||
| 22 | 21 | * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为"ISERVER","GEOJSON"。 | |
| 23 | 22 | * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 | |
| 24 | 23 | * @param {Object} [options.headers] - 请求头。 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,7 +20,6 @@ import {GeoJSON} from '../format/GeoJSON'; | |||
| 20 | 20 | * @param {string} url - 地图查询服务访问地址。如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。 | |
| 21 | 21 | * @param {Object} options - 参数。 | |
| 22 | 22 | * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。 | |
| 23 | - * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。 | ||
| 24 | 23 | * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为"ISERVER","GEOJSON"。 | |
| 25 | 24 | * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 | |
| 26 | 25 | * @param {Object} [options.headers] - 请求头。 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments