Search code examples
javajerseyjax-rs

Moving ClientFilter from Jersey to Jersey 2


I am trying to migrate the usages of Jersey Client in my codebase from com.sun.jersey.client to org.glassfish.jersey.client.

In multiple parts of the codebase I am creating classes that inherit from ClientFilter and override the handle method.

What is the replacement of ClientFilter in Jersey 2 and how should I change the places I use it?


Solution

  • See Jersey docs section Client Filters. Basically there are ClientRequestFilter and ClientResponseFilter. The former is called before the request goes out and the latter is called on the incoming response. See also this post for more info on the flow.