Binder
in JerseyRestService
binds resource instances from other contexts
#3312
Labels
bug_report
Suspected bugs, awaiting triage
Bug Report
Describe the Bug
Binder
inJerseyRestService
binds resource instances from other contexts.Expected Behavior
Binder
inJerseyRestService
binds resource instances only from the correct (single) context.Observed Behavior
Binder
inJerseyRestService
binds resource instances from other contexts.Steps to Reproduce
Context Information
Bug in EDC version 0.1.3 still present, observed with sovity edc community edition connector version 4.0.1 that is using EDC in a 0.0.1 version.
I noticed
The /check/* endpoint has been moved under the 'management' context, please update your url accordingly, because this endpoint will be deleted in the next releases
in the logs even though that they use the check endpoint on the management API in the docker image.=> The wrong ObservabilityApiController instance (that one of the default context with the deprecated=true parameter) was bound to the management context/servlet.
Detailed Description
https://github.com/eclipse-edc/Connector/blob/main/extensions/common/http/jersey-core/src/main/java/org/eclipse/edc/web/jersey/JerseyRestService.java#L116
controllers
is the Map<String, List> that holds the resources of all the contexts. The Key of the entries is the contextAlias.The logic of the binder binds resources of any context but should only bind the resources of the correct, single context.
Possible Implementation
We could provide the resources/controllers of the context to the binder via ctor parameter in this line easily: https://github.com/eclipse-edc/Connector/blob/main/extensions/common/http/jersey-core/src/main/java/org/eclipse/edc/web/jersey/JerseyRestService.java#L91
as the resources/controllers are available as
controllers
in this scope. We could have an attributeList<Object> controllers
in theBinder
class and make it a static inner class as we would no longer use the controllers-Map from the outer class.Or we could provide the contextAlias via ctor parameter to the Binder and change the implementation to only consider those entries of
controllers.get(contextAlias).forEach
in this line: https://github.com/eclipse-edc/Connector/blob/main/extensions/common/http/jersey-core/src/main/java/org/eclipse/edc/web/jersey/JerseyRestService.java#L116The text was updated successfully, but these errors were encountered: