eclipse-ee4j / eclipse-ee4j/jersey

Jersey returns 500 when one @NameBinding annotation is bound to multiple filters

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

Description

In the Jersey servlet container setup with these bounded features:

```
@Path("/test")
public class SomeResource {
@GET
@Auth
public Response someAuthedEndpoint() {
return Response.noContent().build();
}
}

@NameBinding
@Retention(RUNTIME)
@Target({TYPE, METHOD})
public @interface Auth {
}

@Provider
@Priority(0)
@Auth
public class AuthorizationFilter implements ContainerRequestFilter {
...
}

@Provider
@Priority(100)
@Auth
public class AuthenticationFilter implements ContainerRequestFilter {
...
}
```

Jersey server returns 500 with no response body and no diagnostics log to identify what went wrong. If I leave just one of these filters bound to this annotations, it works fine. JAX-RS2 `NameBinding` annotation javadoc says that one named binding can activate one or more filters (https://docs.oracle.com/javaee/7/api/javax/ws/rs/NameBinding.html) so I assume it's a bug.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the servlet-container setup with one @NameBinding annotation applied to both AuthorizationFilter and AuthenticationFilter, using their shown priorities. Compare it with the working setup containing only one filter and inspect the 500 response for diagnostics. Done means multiple filters bound to the same name binding work as specified and the failure, if retained, is diagnostically visible.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.