- 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.
推薦閱讀
- 操作系統(tǒng)實(shí)用教程(Linux版)
- Implementing Cisco UCS Solutions
- Hands-On DevOps with Vagrant
- Windows Server 2019 Administration Fundamentals
- Linux自動(dòng)化運(yùn)維:Shell與Ansible(微課版)
- Linux系統(tǒng)安全基礎(chǔ):二進(jìn)制代碼安全性分析基礎(chǔ)與實(shí)踐
- STM32庫(kù)開(kāi)發(fā)實(shí)戰(zhàn)指南:基于STM32F4
- AWS Development Essentials
- 從實(shí)踐中學(xué)習(xí)Kali Linux無(wú)線(xiàn)網(wǎng)絡(luò)滲透測(cè)試
- OpenStack系統(tǒng)架構(gòu)設(shè)計(jì)實(shí)戰(zhàn)
- 一學(xué)就會(huì):Windows Vista應(yīng)用完全自學(xué)手冊(cè)
- 分布式高可用架構(gòu)之道
- Windows 7實(shí)戰(zhàn)從入門(mén)到精通(超值版)
- Ubuntu Linux操作系統(tǒng)實(shí)用教程
- 大規(guī)模分布式系統(tǒng)架構(gòu)與設(shè)計(jì)實(shí)戰(zhàn)