Skip to content

Commit 91b0b3c

Browse files
committed
修改dataflow例子
1 parent ec000c4 commit 91b0b3c

13 files changed

+67
-17
lines changed

dist/iclient-classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6003,7 +6003,7 @@ _SuperMap2.default.SecurityManager = {
60036003
},
60046004

60056005
_getTokenStorageKey: function _getTokenStorageKey(url) {
6006-
var patten = /http:\/\/([^\/]+)/i;
6006+
var patten = /(.*?):\/\/([^\/]+)/i;
60076007
var result = url.match(patten);
60086008
if (!result) {
60096009
return url;

dist/iclient-classic.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iclient9-leaflet.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5169,7 +5169,7 @@ _SuperMap2["default"].SecurityManager = {
51695169
},
51705170

51715171
_getTokenStorageKey: function _getTokenStorageKey(url) {
5172-
var patten = /http:\/\/([^\/]+)/i;
5172+
var patten = /(.*?):\/\/([^\/]+)/i;
51735173
var result = url.match(patten);
51745174
if (!result) {
51755175
return url;
@@ -28468,6 +28468,7 @@ var DataFlowService = function (_CommonServiceBase) {
2846828468
}, {
2846928469
key: '_connect',
2847028470
value: function _connect(url) {
28471+
url = this._appendCredentials(url);
2847128472
if ("WebSocket" in window) {
2847228473
return new WebSocket(url);
2847328474
} else if ("MozWebSocket" in window) {
@@ -28477,6 +28478,15 @@ var DataFlowService = function (_CommonServiceBase) {
2847728478
return null;
2847828479
}
2847928480
}
28481+
}, {
28482+
key: '_appendCredentials',
28483+
value: function _appendCredentials(url) {
28484+
var token = _SuperMap2["default"].SecurityManager.getToken(url);
28485+
if (token) {
28486+
url += "?token=" + token;
28487+
}
28488+
return url;
28489+
}
2848028490
}]);
2848128491

2848228492
return DataFlowService;

dist/iclient9-leaflet.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iclient9-mapboxgl.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10932,6 +10932,7 @@ var DataFlowService = function (_CommonServiceBase) {
1093210932
}, {
1093310933
key: '_connect',
1093410934
value: function _connect(url) {
10935+
url = this._appendCredentials(url);
1093510936
if ("WebSocket" in window) {
1093610937
return new WebSocket(url);
1093710938
} else if ("MozWebSocket" in window) {
@@ -10941,6 +10942,15 @@ var DataFlowService = function (_CommonServiceBase) {
1094110942
return null;
1094210943
}
1094310944
}
10945+
}, {
10946+
key: '_appendCredentials',
10947+
value: function _appendCredentials(url) {
10948+
var token = _SuperMap2.default.SecurityManager.getToken(url);
10949+
if (token) {
10950+
url += "?token=" + token;
10951+
}
10952+
return url;
10953+
}
1094410954
}]);
1094510955

1094610956
return DataFlowService;
@@ -35987,7 +35997,7 @@ _SuperMap2.default.SecurityManager = {
3598735997
},
3598835998

3598935999
_getTokenStorageKey: function _getTokenStorageKey(url) {
35990-
var patten = /http:\/\/([^\/]+)/i;
36000+
var patten = /(.*?):\/\/([^\/]+)/i;
3599136001
var result = url.match(patten);
3599236002
if (!result) {
3599336003
return url;

dist/iclient9-mapboxgl.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iclient9-openlayers.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4716,7 +4716,7 @@ _SuperMap2.default.SecurityManager = {
47164716
},
47174717

47184718
_getTokenStorageKey: function _getTokenStorageKey(url) {
4719-
var patten = /http:\/\/([^\/]+)/i;
4719+
var patten = /(.*?):\/\/([^\/]+)/i;
47204720
var result = url.match(patten);
47214721
if (!result) {
47224722
return url;
@@ -23747,6 +23747,7 @@ var DataFlowService = function (_CommonServiceBase) {
2374723747
}, {
2374823748
key: '_connect',
2374923749
value: function _connect(url) {
23750+
url = this._appendCredentials(url);
2375023751
if ("WebSocket" in window) {
2375123752
return new WebSocket(url);
2375223753
} else if ("MozWebSocket" in window) {
@@ -23756,6 +23757,15 @@ var DataFlowService = function (_CommonServiceBase) {
2375623757
return null;
2375723758
}
2375823759
}
23760+
}, {
23761+
key: '_appendCredentials',
23762+
value: function _appendCredentials(url) {
23763+
var token = _SuperMap2.default.SecurityManager.getToken(url);
23764+
if (token) {
23765+
url += "?token=" + token;
23766+
}
23767+
return url;
23768+
}
2375923769
}]);
2376023770

2376123771
return DataFlowService;

dist/iclient9-openlayers.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/include-openlayers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
inputScript("http://mapv.baidu.com/build/mapv.min.js");
4040
}
4141
if(!inArray(excludes,'iclient9-openlayers')) {
42-
inputScript("../../dist/iclient9-openlayers.js");
42+
inputScript("../../dist/iclient9-openlayers.min.js");
4343
}
4444
if(!inArray(excludes,'iclient9-openlayers-css')) {
4545
inputCSS("../../dist/iclient9-openlayers.min.css");

examples/leaflet/dataFlowService.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
<script type="text/javascript" src="../../dist/include-leaflet.js"></script>
1010
<script type="text/javascript">
1111
var host = window.isLocal ? document.location.protocol + "//" + document.location.host : "http://117.122.248.69:8090";
12-
var wsHost = window.isLocal ? "ws:\\//" + document.location.protocol + "//" + document.location.host : "ws://117.122.248.69:8800";
12+
var wsHost = "ws:\//" + (window.isLocal ? document.location.host: "117.122.248.69:8800");
13+
var token = "jDTu8vHZoo9ABgE_IW48UcyYbwBhlOmfIub7gscWjzmiszd0vKC7xtcp8pIcK0eAAzANtETZdaFiE9d1l9Ojtg..";
1314
var map,
1415
urlMap = host + "/iserver/services/map-china400/rest/maps/China",
1516
urlQuery = host + "/iserver/services/map-china400/rest/maps/China_4326",
@@ -22,6 +23,10 @@
2223
zoom: 12
2324
});
2425
L.supermap.tiledMapLayer(urlMap).addTo(map);
26+
if(!window.isLocal){
27+
SuperMap.SecurityManager.registerToken(urlDataFlow, token);
28+
}
29+
2530
//创建DataFlowLayer,创建DataFlowLayer订阅DataFlow并将结果加载到地图上
2631
var dataFlowLayer = L.supermap.dataFlowLayer(urlDataFlow, {
2732
style: function (feature) {

0 commit comments

Comments
 (0)