jax rs - JAX-RS Client Filter to Modify Header Before Request is Dispatched to server -


in jax-rs (resteasy), want implement client filter modifies header before sending request don't manually every single call.

currently i'm doing in receiving end intercept requests before arriving resource.

@provider @priority(priorities.authentication) public class authenticationfilter implements containerrequestfilter {      @override     public void filter(containerrequestcontext requestcontext) throws ioexception {          // read header     } 

now know (correct me if i'm wrong):

in receiving end, containerrequestfilter can used before request arrives resource , request.

but want implement in client side, modify header before request ever sent server. can same server filter used or there similar client?

you must register clientrequestfilter client

client client = clientbuilder.newclient().register(myfilter.class);  @provider public class myfilter implements clientrequestfilter {      @override     public void filter(clientrequestcontext ctx) throws ioexception {         // modify header before send: ctx.getheaders()      } }   

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -