jakartaee / jakartaee/rest

Container filter and interceptor contexts should return a list of binding annotations

Open
#463 3 comments 0 reactions 0 assignees View on GitHub
Component: filters&handlers
Dominant language
Java
Stars
400
Forks
143
PR merge metrics
No merged PRs in 30d

Description

We've had a user asking for supporting this case:

```
@A
public MyFilter implements ContainerRequestFilter {
// needs to get an access to @A on the bound methods }

@Path("root")
public MyRoot {

@GET
@Path("1")
@A("1")
public getIt1() {}

@GET
@Path("2")
@A("2")
public getIt2() {}
}
```

So effectively @A is a conduit for passing parameters to the filter re what it needs to do on a per-method specific basis.

My answer was to inject ResourceInfo and proceed from there. This can work but might be tricky in some inheritance cases I guess and won't work if the filter was bound indirectly via Application having A("somevalue").

Perhaps we can have contexts having a new method introduced:
Annotation[] getBindingAnnotations().
#### Affected Versions
[2.0]

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the container filter and interceptor context APIs and the existing ResourceInfo approach described in the issue. Trace how binding annotations are available for filters bound directly and through Application. Done means a reviewed API change that returns the relevant annotations for the shown per-method and indirect-binding cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.