mercredi 8 avril 2015

Intercept all HTTP requests going out of a Java Application

In our project, we need to pass a certain header information in all the REST calls that are sent out to other internal APIs.


One way is to change all the hundreds or even thousands of REST invocations to add this mapping before the REST call is initiated.


But, I was wondering if there is a smarter way of doing this using aspects/filters/listeners/interceptors in Spring/Java?


Example: If I make a call from REST API 1 to an endpoint, I am trying to explore a way to intercept the constructed HTTP request and add the header and fire the request.


Any suggestions about solving or any other good practices are welcome.


Thank you.


Aucun commentaire:

Enregistrer un commentaire