4. Servlet Connector的入口Servlet:
com.esri.esrimap.Esrimap 參數
ServiceName ArcIMS 服務名
ClientVersion ArcIMS 版本号
Form true請求來自HTML的Form
Encode
* 請求重定向 CustomService 參數
原因:
影像虛拟服務(Image MapService) 不提供"屬性資訊","幾何資訊","地理編碼"等的功能,是以請求被重定向到其它的虛拟服務。
即:
When sending a request other than GET_IMAGE to an image MapService,redirection is required;
Redirection is achieved in action attribute of the PostForm:
GET_FEATURES
CustomService = Query
GET_GEOCODE
CustomService = Geocode
GET_EXTRACT
CustomService = Extract
Http://caesar1:8888/servlet/com.esri.esrimap.Esrimap?ServiceName=Beijing&CustomService=Query&ClientVersion=3.1&Form=true
5.PostForm
ArcXMLRequest(required) ArcXML request being sent to the server
JavaScriptFunction(optional) 指定 jsForm.htm 中的處理response 函數名,預設為passXML()
RedireURL(optional)
BgColor(optional)
FormCharset(optional)
6.請求與響應的過程:
1>Request --> Servlet Connector -->Application Server
Servlet Connector對傳來的Request進行解析,隻傳給Application Server :
* ServiceName
* ArcXMLRequest
其餘參數由Servlet Connector保留對響應(Response)的格式設定
2>對Servlet Connector的調用為:
http://hostName/servlet/com.esri.esrimap.Esrimap
3>響應:Application Server将參數傳遞給 Spatial Server,Spatial Server将響應
(Response)傳回給 Application Server,所有的 Response隻有兩種:
* ArcXML 包含屬性資訊、圖檔的URL(HTML Viewer隻能處理這一種)
* Feature Stream 二進制壓縮要素流
4>the Servlet Connector Creates a new HTML page based on
* Value of the input elements specified in the request
* Default values of the input elements
* The Response ArcXML
請求
一、最基本函數:
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