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

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.

主站蜘蛛池模板: 连平县| 高尔夫| 哈密市| 永清县| 南靖县| 文安县| 咸阳市| 连江县| 定兴县| 海丰县| 张掖市| 阳曲县| 原平市| 天等县| 宜昌市| 黄浦区| 长海县| 泽州县| 新昌县| 甘谷县| 峨边| 镇安县| 大埔区| 浮山县| 方山县| 交城县| 山西省| 巩留县| 鄂温| 金阳县| 永福县| 华蓥市| 武陟县| 四平市| 宾阳县| 若尔盖县| 信阳市| 秦皇岛市| 彭阳县| 剑川县| 邯郸市|