ArcIMS学习之 HTML Viewer定制笔记 续三(3.请求&响应)

来源:互联网 发布:光纤传输数据 编辑:程序博客网 时间:2024/05/01 14:27

请求
一、最基本函数:
 sendToServer --> htmlSendToServer
 提交表单 PostForm
(aimsXML.js)
 参数:
  URLString 
  XMLRequest Request ArcXML
  theType  XMLMode的值,默认为1,GET_IMAGE
sendToServer将 theType 赋给XMLMode,然后调用htmlSendToServer提交表单。

二、GET_SERVICE_INFO
 由 getStartExtent()构造,并调用sendToServer(imsURL,theString,3);(aimsCommon.js)
 具体调用关系为:
 viewer.htm在所有Frame装完后,onload一个doIt()--> checkParams --> startMap -->startUp -->getStartExtent
 (startMap、startUp、getStartExtent都在aimsCommon.js)

三、GET_IMAGE
 首次的 GET_IMAGE 是在对GET_SERVICE_INFO的响应中调用的(case 3);
 sendMapXML()
 writeXML()构造得到 Map 图的 ArcXML

响应
一、处理响应最基本函数:
aimsXML.js中的:
    processXML(XMLResponse)根据 XMLMode 处理相关 Response
 function processXML(theReplyIn) {
  ...
  switch(XMLMode) {
   case 1: //得到地图GET_IMAGE
   ...
   default: //XMLMode >= 1000交给用户定制处理
    if (XMLMode >= 1000) {
     useCustomFunction(theReply); 
    } else {
     alert(theReply + msgList[19]);
    } 
 }

二、
case 3: GET_SERVICE_INFO
保存查到的地图最大值,调用 ProcessStartExtent(theReply) (aimsCommon.js)
 -->sendMapXML(){
   writeXML();
   sendToServer(,,1);
  }
三、用户定制:
processXML 中当 XMLMode大于1000时,为用户定制处理:
  default://XMLMode >= 1000交给用户定制处理
   // send any responses to custom requests off to the custom handler
   // XMLMode >= 1000 are reserved for custom requests/responses
   if (XMLMode >= 1000) {
    useCustomFunction(theReply); 
 useCustomFunction(theReply)在aimsCustom.js中
 
 接收的Servlet为com.esri.esrimap.Esrimap