1、通过当前Resorces得到
UIComponent form = facesContext.getViewRoot().findComponent(
(String) paramMap.get("formId"));
if (form == null) {
return;
}
MapControl mapControl = (MapControl) form
.findComponent((String) paramMap.get("mapId"));
if (mapControl == null) {
return;
}
WebMap webMap = mapControl.getWebMap();
WebContext webContext = webMap.getWebContext();
// 得到当前服务的IServerContext
AGSLocalMapResource mapResource = (AGSLocalMapResource) webContext
.getResources().get("ags1");
MapServer mapServer = mapResource.getLocalMapServer();
IServerContext serverContext = mapResource.getServerContext();
2、通过IP链接的Resources得到
ServerConnection connection = null;
// 、、、、、、、、、、、、、、、、、、、、、、链接到服务器
ServerInitializer serverInitializer = new ServerInitializer();
serverInitializer.initializeServer("10.2.9.22",
"administrator", "oil");
connection = new ServerConnection();
connection.connect("10.2.9.22"); // 服务器名
// 链接到SOA
IServerObjectAdmin serverObjectAdmin = connection
.getServerObjectAdmin();
// 得到serverContext
IServerObjectManager serverObjectManager = connection
.getServerObjectManager();
IServerContext serverContext = serverObjectManager
.createServerContext("globe", "MapServer");
本文介绍了两种获取IServerContext的方法:一是通过当前资源获取;二是通过IP链接的资源获取。这两种方式都涉及到MapServer和ServerContext的相关操作。

2320

被折叠的 条评论
为什么被折叠?



