- 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.
推薦閱讀
- 全屋互聯(lián):智能家居系統(tǒng)開發(fā)指南
- Mobile-first Bootstrap
- Linux從零開始學(xué)(視頻教學(xué)版)
- UNIX操作系統(tǒng)設(shè)計(jì)
- 嵌入式Linux驅(qū)動(dòng)程序和系統(tǒng)開發(fā)實(shí)例精講
- Windows Phone應(yīng)用程序開發(fā)
- 計(jì)算機(jī)系統(tǒng)開發(fā)與優(yōu)化實(shí)戰(zhàn)
- RESS Essentials
- Linux自動(dòng)化運(yùn)維:Shell與Ansible(微課版)
- 嵌入式系統(tǒng)原理及開發(fā)
- OpenStack系統(tǒng)架構(gòu)設(shè)計(jì)實(shí)戰(zhàn)
- 深入淺出Node.js
- Delphi Programming Projects
- OpenSolaris設(shè)備驅(qū)動(dòng)原理與開發(fā)
- Distributed Computing with Go