- Java EE 8 High Performance
- Romain Manni Bucau
- 176字
- 2021-06-30 19:14:28
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:
- Find the class matching the request based on the path (this is a regex-like logic).
- 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.)
- 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.
推薦閱讀
- Linux運維之道(第3版)
- 全屋互聯:智能家居系統開發指南
- Learning OpenDaylight
- Learning Android Intents
- Windows Vista融會貫通
- Ceph分布式存儲實戰
- Docker容器技術與應用
- 應急指揮信息系統設計
- Linux操作系統案例教程(第2版)
- Learn Quantum Computing with Python and IBM Quantum Experience
- 鴻蒙HarmonyOS應用開發入門
- Less Web Development Essentials
- Docker容器技術與運維
- Windows 8玩全不求人
- iOS Programming Cookbook