web services - JAX-RS: Non-programmatical registration of a ClientRequestFilter -


i want use clientrequestfilter modify outgoing rest requests of application without changing source code.

so far, have found ways register filter programmatically:

   client client = clientbuilder.newclient();     client.register(new myclientrequestfilterimpl());    webtarget =  client.target(uribuilder); 

is possible use web.xml or similar?

as far know there no such way can read configuration file on own. assuming following file:

com.foo.bar.filter1 com.foo.bar.filter2 

you can register filters this:

list<string> filters = files.readalllines(paths.get(new uri("/your/config/file")), charset.forname("utf-8")); client client = clientbuilder.newclient(); (string filter : filters) {     client.register(class.forname(filter)); } 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -