- Java EE 8 High Performance
- Romain Manni Bucau
- 195字
- 2021-06-30 19:14:28
Filter and interceptors
JAX-RS 2.0 added ContainerRequestFilter and ContainerResponseFilter to modify the request context. It is executed around the method invocation but has already passed the method resolution. On a high level, it can be seen as a CDI interceptor but only at the HTTP layer. These filters do not impact significantly the performance until they do a lot of logic, and there are a few cases where it is a good place to put some logic. One very common example is to validate a security token or log in a user based on the HTTP headers. Don't be surprised to see this kind of component while investigating what your application is doing.
In the same spirit, ReaderInterceptor and WriterInterceptor intercept MessageBodyReader or MessageBodyWriter. They are intended to wrap the input/output streams to add some support such as GZIP compression. However, since we are close to the current I/O, we need to take care to not add too much logic here if the payloads are huge or if the algorithm is complex. In fact, since the stream operations are called very often, a badly implemented wrapper can affect the performance.
- Social Media Mining with R
- Google系統架構解密:構建安全可靠的系統
- Linux內核完全注釋(20周年版·第2版)
- VMware Horizon View 6 Desktop Virtualization Cookbook
- SharePoint 2013 WCM Advanced Cookbook
- Linux性能優化
- 嵌入式操作系統(Linux篇)(微課版)
- 深入理解eBPF與可觀測性
- 網絡操作系統教程:Windows Server 2016管理與配置
- Linux系統安全基礎:二進制代碼安全性分析基礎與實踐
- Delphi Programming Projects
- INSTANT Migration from Windows Server 2008 and 2008 R2 to 2012 How-to
- 深入淺出Node.js
- iOS 8開發指南
- Windows 8完全自學手冊