eclipse-ee4j / eclipse-ee4j/jersey

Not able to create custom ResourceMethodDispatcherProvider in jersey >= 2.26

Open
#5,849 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

I have a code that used to work till jersey < 2.26 (before removal of hard wiring with HK2).
We were able to create a **CustomResourceMethodDispatcherProvider** (implements **ResourceMethodDispatcher.Provider**) and bind it via custom **ResourceConfig** and all rest calls would be dispatched by our own own dispatcher.

But this doesn't seem to work anymore. Tried a couple of options
1. Changed the **AbstractBinder** import to jersey one,
2. register a custom Feature, also tried registering custom provider via **Feature** but it didn't let me since it was trying to replace an internal class
3. experiment with Provider annotation and web.xml.
4. Extend **RequestMethodDispatcherFactory** and bind it.

None of the these worked. Upon code inspection, it looks like **ApplicationHandler.java** constructs **ResourceMethodInvoker** with internal class **RequestMethodDispatcherFactory**. And this Factory class instantiates only 2 internal providers (**VoidVoidDispatcherProvider** and **JavaResourceMethodDispatcherProvider**).

Is there a way to associate my custom ResourceMethodDispatcher and its Provider in jersey >= 2.26 ?

Contributor guide

Open the contributing guide

Research direction

Start by reading ApplicationHandler.java, ResourceMethodInvoker, and RequestMethodDispatcherFactory, then compare the pre-2.26 dispatch and binding path described in the issue. Done means establishing whether a supported registration path exists for a custom ResourceMethodDispatcher.Provider in Jersey 2.26 or later, with the relevant limitation or usage documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.