Class RestTemplateInterceptor

  • All Implemented Interfaces:
    org.springframework.http.client.ClientHttpRequestInterceptor

    @Component
    public class RestTemplateInterceptor
    extends Object
    implements org.springframework.http.client.ClientHttpRequestInterceptor
    It is used to intercept any http calls made using rest template from this application. CONFIG: This is added to the list of interceptors in the RestTemplate bean created in the SecurityConfig. TASKS: 1. Intercept all the requests from the application and do the below tasks. 2. Intercept a request to add auth token to the "Authorization" header. 3. Intercept a response to modify the stored token with the "Authorization" header of the response.
    Since:
    1.0.0
    Author:
    Sabbu Uday Kumar, Ramadurai Saravana Pandian, Raj Jha
    • Constructor Detail

      • RestTemplateInterceptor

        public RestTemplateInterceptor()
    • Method Detail

      • intercept

        public org.springframework.http.client.ClientHttpResponse intercept​(org.springframework.http.HttpRequest httpRequest,
                                                                            byte[] bytes,
                                                                            org.springframework.http.client.ClientHttpRequestExecution clientHttpRequestExecution)
                                                                     throws IOException
        Specified by:
        intercept in interface org.springframework.http.client.ClientHttpRequestInterceptor
        Throws:
        IOException