2

I want to add a Authorization header to all outgoing requests of my Spring 3.2 application.

This solution describes how to do it by adding an interceptor to a web service template (e.g. RestTemplate):

Setting a custom HTTP header dynamically with Spring-WS client

Is there a way to do it without adding interceptors to my restTemplates? Globally, for all outgoing request?

Community
  • 1
  • 1
Mirko
  • 331
  • 2
  • 6
  • 17
  • possible duplicate of [how to set header no cache in spring mvc 3 by annotation](http://stackoverflow.com/questions/4364622/how-to-set-header-no-cache-in-spring-mvc-3-by-annotation) – NimChimpsky May 31 '13 at 14:52
  • Sorry, but I still don't understand how I would use WebContentInterceptor to add headers to outgoing requests. Maybe because the examples that I find intercept inbound requests or outbound responses (whereas I want to intercept outbound requests that my applications makes to another application). My idea at the moment is: - extend org.springframework.web.servlet.mvc.WebContentInterceptor (could I also implement HandlerInterceptor?) - override prehandle(…) - add the header to the HttpServletRequest in prehandle() Is that correct? – Mirko Jun 03 '13 at 06:32
  • As far as I understand this is not working for outgoing requests. Any other ideas are appreciated. – Mirko Jun 04 '13 at 08:00

0 Answers0