Intercept JAX-RS Request: Register a ContainerRequestFilter with tomcat

后端 未结 3 2003
太阳男子
太阳男子 2020-12-30 09:15

I am trying to intercept a request to my JAX-RS webservice by a ContainerRequestFilter. I want to use it with a custom annotation, so I can decorate certain methods of the w

3条回答
  •  盖世英雄少女心
    2020-12-30 09:24

    Just compiling the answer from Michael Gajdos to help someone who do not want open more tabs:

    When you are using Jersey-2 you must use the follow configuration to register your filter into the web.xml

    jersey.config.server.provider.classnames

    instead of

    com.sun.jersey.spi.container.ContainerRequestFilters (jersey-1x)

     
        
          //...         
         
             jersey.config.server.provider.classnames
             com.your_package_path.yourClassFilter
         
          //...
    
    

提交回复
热议问题