Dispatcher类总共有将近2000行代码。。
Dispatcher继承自AbstractController,从之前的博客(https://www.cnblogs.com/2008nmj/p/14768732.html)可以知道,该类是负责处理请求的,转发给各个相关的类分别处理。
看该类的简介:
/**
* Dispatches an http request to an open web service (OWS).将一个http请求派发给OWS。
*
* <p>An OWS request contains three bits of information:一个OWS请求包含三点信息:
*
* <ol>
* <li>The service being called 调用的服务
* <li>The operation of the service to execute 服务要执行的的操作
* <li>The version of the service ( optional ) 服务的版本(可选)
* </ol>
*
* <p>Additional, an OWS request can contain an arbitray number of additional parameters.除此之外,一个OWS请求还可以包含任意数量的额外的参数。
*
* <p>An OWS request can be specified in two forms. The first form is known as "KVP" in which all一个OWS请求可以以两种形式来指定。第一种形式是“KVP”,其中所有的参数都是以键值对的形式组成的。通常,这种形式的请求是以http "GET"请求的方式生成的,参数
* the parameters come in the form of a set of key-value pairs. Commonly this type of request is 在请求字符串中指定:
* made in an http "GET" request, the parameters being specified in the query string:
*
* <pre>
* <code>http://www.xyz.com/geoserver?service=someService&request=someRequest&version=X.Y.Z&param1=...&param2=...</code>
* </pre>
*
* <p>This type of request can also be made in a "POST" request in with a mime-type of
* "application/x-www-form-urlencoded".
*
* <p>The second form is known as "XML" in which all the parameters come in the form of an xml
* document. This type of request is made in an http "POST" request.
*
* <pre><code>
* <?xml version="1.0" encoding="UTF-8"?>
* <SomeRequest service="someService" version="X.Y.Z">
* <Param1>...</Param1>
* <Param2>...</Param2>
* ...
* </SomeRequest>
* </code></pre>
*
* <p>When a request is received, the <b>service</b> the <b>version</b> parameters are used to
* locate a service desciptor, an instance of {@link Service} . With the service descriptor, the
* <b>request</b> parameter is used to locate the operation of the service to call.
*
* @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
*/
/**
*
*
*<p>OWS请求包含三位信息:
*
*<ol>
*<li>正在调用的服务
*<li>要执行的服务的操作
*<li>服务的版本(可选)
*</ol>
*
*<p>另外,OWS请求可以包含任意数量的附加参数。
*
*<p>OWS请求可以用两种形式指定。第一种形式称为“KVP”,其中
*参数以一组键值对的形式出现。通常这种类型的请求是
*在http“GET”请求中进行,参数在查询字符串中指定:
*
*<预>
*<代码>http://www.xyz.com/geoserver?service=someService&request=someRequest&amp;版本=X.Y.Z&amp;参数1=…&amp;param2=…</code>
*</pre>
*
*<p>这种类型的请求也可以在mime类型为的“POST”请求中进行
*“应用程序/x-www-form-urlencoded”。
*
*<p>第二种形式称为“XML”,其中所有参数都以XML的形式出现
*文件。这种类型的请求是在http“POST”请求中发出的。
*
*<pre><code>
*&lt;?xml version=“1.0”encoding=“UTF-8”?&gt;
*&lt;SomeRequest service=“someService”version=“X.Y.Z”&gt;
*&lt;参数1&gt&lt/参数1&gt;
*&lt;参数2&gt&lt/参数2&gt;
* ...
*&lt/SomeRequest&gt;
*</code></pre>
*
*<p>当接收到请求时,<b>服务</b>版本</b>参数用于
*找到服务描述符,{@link service}的实例。使用服务描述符
*<b>请求</b>参数用于定位要调用的服务的操作。
*
*@作者Justin Deoliveira,开放式规划项目,jdeolive@openplans.org
*/
原文:https://www.cnblogs.com/2008nmj/p/14777691.html