armeria
armeria copied to clipboard
Provide a way to find dynamic decorators handling the current request
Motivation:
HttpService.as(Class) can be used to unwrap and find an instance of a decorator or a service.
ServiceRequestContext.config().service().as(Class) can't find all decorators because decorators set with ServerBuilder.decorator() don't statically wrap the services.
I propose to add ServiceRequestContext.findService(Class) for finding both dynamic and static decorators handling a request.
Modifications:
- Add
ServiceRequestContext.findService(Class)that gets all service chain fromInitialDispatcherServiceand finds the specific service.
Result:
You can now easily find both dynamic and static decorators that handle a request by using ServiceRequestContext.findService(Class).
🔍 Build Scan® (commit: aba621968e8eb38a206d0e6404ecb40eea9ff544)
| Job name | Status | Build Scan® |
|---|---|---|
| build-windows-latest-jdk-21 | ✅ | https://ge.armeria.dev/s/q2f6utrid47gy |
| build-self-hosted-unsafe-jdk-8 | ✅ | https://ge.armeria.dev/s/pyu2pacvwfc4u |
| build-self-hosted-unsafe-jdk-21-snapshot-blockhound | ✅ | https://ge.armeria.dev/s/3cfbhprhoylyy |
| build-self-hosted-unsafe-jdk-17-min-java-17-coverage | ✅ | https://ge.armeria.dev/s/y4i5h5cht7zo2 |
| build-self-hosted-unsafe-jdk-17-min-java-11 | ✅ | https://ge.armeria.dev/s/7f3l3xphqggqy |
| build-self-hosted-unsafe-jdk-17-leak | ✅ | https://ge.armeria.dev/s/uhvzhlnskz7xe |
| build-self-hosted-unsafe-jdk-11 | ✅ | https://ge.armeria.dev/s/pvnmuvrkstvpg |
| build-macos-12-jdk-21 | ✅ | https://ge.armeria.dev/s/dg7qtcaa6duxg |