-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContainerRequestFilter get invoked twice with one request #3994
Comments
Filter is instantiated twice in 192. Same problem with ContainerResponseFilter |
Can you create a test case on GitHub we could use? |
https://github.com/mikael2/Payara192DoubleFilter Example from Payara output below: INFO: ResponseFilter() payara.doublefilter192.ResponseFilter@cd0095 |
URL :http://localhost:8080/Backend/ws/data/test Test case attached: |
Double instantiation occurs with all modes but "none". Another workaround is to override equals and hashCode methods so that all filter instances are equal: import javax.ws.rs.ext.Provider;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
@Provider
public class MyDummyFilter implements ContainerRequestFilter {
@Override
public void filter(ContainerRequestContext cr) {
/* ... */
}
@Override
public boolean equals(Object o){
return o instanceof MyDummyFilter;
}
@Override
public int hashCode() {
return this.getClass().hashCode();
}
} Duplicates are evicted by org.glassfish.jersey.internal.inject.Providers#getAllRankedProviders, line 188 (org.glassfish.jersey.core:jersey-common:2.29.payara-p2) |
A little more natural workaround is to annotate the filter with I managed to reproduce the issue against Jersey upstream, we'll work on the fix there. (Caused by fix for eclipse-ee4j/jersey#3670) |
Internally tracked as PAYARA-3908 |
…ara#3994) Signed-off-by: Markus KARG <[email protected]>
Description
ContainerRequestFilter get invoked twice with one request, when using roles allowed annotation.
Code:
payara-web.xml:
Expected Outcome
ContainerRequestFilter should only get invoked once (like in payara 5.191). Header string get added only once.
Current Outcome
ContainerRequestFilter get invoked twice with one request. Because of that it adds the same header string twice which cause problems.
Environment
The text was updated successfully, but these errors were encountered: