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

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.

主站蜘蛛池模板: 冀州市| 东兴市| 蓝田县| 鄂伦春自治旗| 唐山市| 莫力| 汉源县| 长泰县| 故城县| 台山市| 浮山县| 民丰县| 雷州市| 宜兰县| 年辖:市辖区| 景洪市| 临朐县| 顺义区| 乐山市| 固镇县| 游戏| 长汀县| 资阳市| 祁门县| 沙坪坝区| 胶南市| 张家界市| 铜川市| 石棉县| 大方县| 台中市| 内丘县| 富锦市| 额尔古纳市| 正蓝旗| 公主岭市| 方城县| 龙南县| 平阴县| 沭阳县| 吴江市|