得到IServerContext的两种方法

本文介绍了两种获取IServerContext的方法:一是通过当前资源获取;二是通过IP链接的资源获取。这两种方式都涉及到MapServer和ServerContext的相关操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、通过当前Resorces得到

 

ContractedBlock.gifExpandedBlockStart.gifCode
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得到

 

ContractedBlock.gifExpandedBlockStart.gifCode
                                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");

 

转载于:https://www.cnblogs.com/gaofei_work/archive/2009/10/19/1585828.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值