Class HeaderSettingRequestInterceptor

java.lang.Object
com.gooddata.sdk.service.HeaderSettingRequestInterceptor
All Implemented Interfaces:
org.springframework.http.client.ClientHttpRequestInterceptor

public class HeaderSettingRequestInterceptor
extends java.lang.Object
implements org.springframework.http.client.ClientHttpRequestInterceptor
Intercepts client-side HTTP requests and sets HTTP headers passed to constructor of this class. Implementations of this interface can be registered with the RestTemplate, as to modify the outgoing ClientHttpRequest and/or the incoming ClientHttpResponse.
  • Constructor Summary

    Constructors 
    Constructor Description
    HeaderSettingRequestInterceptor​(java.util.Map<java.lang.String,​java.lang.String> headers)
    Construct interceptor for setting given HTTP headers.
  • Method Summary

    Modifier and Type Method Description
    org.springframework.http.client.ClientHttpResponse intercept​(org.springframework.http.HttpRequest request, byte[] body, org.springframework.http.client.ClientHttpRequestExecution execution)
    Intercept the given request, set headers passed to constructor, and return a response.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HeaderSettingRequestInterceptor

      public HeaderSettingRequestInterceptor​(java.util.Map<java.lang.String,​java.lang.String> headers)
      Construct interceptor for setting given HTTP headers.
      Parameters:
      headers - the map of HTTP header names to header values
  • Method Details

    • intercept

      public org.springframework.http.client.ClientHttpResponse intercept​(org.springframework.http.HttpRequest request, byte[] body, org.springframework.http.client.ClientHttpRequestExecution execution) throws java.io.IOException
      Intercept the given request, set headers passed to constructor, and return a response. The given ClientHttpRequestExecution allows the interceptor to pass on the request and response to the next entity in the chain.
      Specified by:
      intercept in interface org.springframework.http.client.ClientHttpRequestInterceptor
      Parameters:
      request - the request, containing method, URI, and headers
      body - the body of the request
      execution - the request execution
      Returns:
      the response
      Throws:
      java.io.IOException - in case of I/O errors