官术网_书友最值得收藏!

The router

JAX-RS is command-oriented. It means that a request must be bound to a Java method. To do so, the matching takes multiple parameters of the request into account:

  • The patch
  • The Accept header
  • The Content-Type header

Here is the simplified algorithm for routing:

  1. Find the class matching the request based on the path (this is a regex-like logic).
  2. From the class found in step 1, find the method matching the request based on the path. (This is close to step 1 but applied to methods with subresource handling.)
  3. From the methods found in step 2, find the one that will handle the request based on mime types (Accept/Content-Type headers). This level parses the media types to handle the quality of service options (q, qs, and so on) of the header.

This is not a complicated algorithm, but it is quite dynamic and depends on the incoming requests. So most of the time, it is done at runtime by the providers and can add a small overhead, which you can notice during benchmarks.

主站蜘蛛池模板: 江华| 绩溪县| 佳木斯市| 洮南市| 普兰店市| 松原市| 都匀市| 武夷山市| 汪清县| 忻州市| 苗栗县| 桂平市| 商城县| 徐州市| 恭城| 延长县| 阳江市| 鸡东县| 丹凤县| 海宁市| 呼图壁县| 璧山县| 和龙市| 孟村| 咸宁市| 巴彦淖尔市| 青河县| 山阴县| 马鞍山市| 双牌县| 平利县| 怀来县| 南通市| 木兰县| 邹城市| 四会市| 宁明县| 佛冈县| 叙永县| 景德镇市| 县级市|