In JAX-RS (RestEasy), I want to implement a client filter that modifies the header before sending the request so I don't do this manually for every single call.
Currently I'm doing this in the receiving end to intercept requests before arriving to the resource.
@Provider
@Priority(Priorities.AUTHENTICATION)
public class AuthenticationFilter implements ContainerRequestFilter {
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
// read header
}
Now I know this (Correct me if I'm wrong):
In the receiving end, ContainerRequestFilter
can be used before the request arrives to the resource and get the request.
But I want to implement this in the client side, to modify the header before the request is ever sent to the server. Can the same server filter be used or there is something similar to for the client?
You must register a ClientRequestFilter into your Client