Jersey ContainerRequestFilter not triggered

后端 未结 10 531
囚心锁ツ
囚心锁ツ 2020-12-05 06:34

I\'m trying to use a ContainerRequestFilter to enforce some authentication on a Tomcat based Jersey application. I followed this document. Problem : the filter

相关标签:
10条回答
  • 2020-12-05 07:23

    We were missing the below call in our ResourceConfig implementation class:

    register(CorrelationIdFilter.class);
    
    0 讨论(0)
  • 2020-12-05 07:23

    I had the same problem for JAX-RS 2 , jersey and the below annotation fixed it

     @PreMatching
    
    0 讨论(0)
  • 2020-12-05 07:24

    I also had to add the @Provider JAX-RS annotation to my filters.
    This makes the filter discoverable during JAX-RS scanning phase.

    @Provider
    public class MyAppFilter implements ContainerRequestFilter {
        // filter logic
    }
    
    0 讨论(0)
  • 2020-12-05 07:29

    For anybody having this problem in MULE ESB. Remember to register path with:

    <jersey:resources doc:name="REST">
       <component doc:name="rest component">
         <spring-object bean="endpoit"/>
       </component>
       <jersey:package packageName="path @Provider-s"/>
    </jersey:resources >
    
    0 讨论(0)
提交回复
热议问题