armeria icon indicating copy to clipboard operation
armeria copied to clipboard

Provide a way to find dynamic decorators handling the current request

Open ikhoon opened this issue 1 year ago • 1 comments

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 from InitialDispatcherService and finds the specific service.

Result:

You can now easily find both dynamic and static decorators that handle a request by using ServiceRequestContext.findService(Class).

ikhoon avatar May 09 '24 06:05 ikhoon

🔍 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

github-actions[bot] avatar May 09 '24 07:05 github-actions[bot]