Class SimpleRequestHeaderInterceptor

java.lang.Object
ca.uhn.fhir.rest.client.interceptor.SimpleRequestHeaderInterceptor
All Implemented Interfaces:
ca.uhn.fhir.rest.client.api.IClientInterceptor

public class SimpleRequestHeaderInterceptor extends Object implements ca.uhn.fhir.rest.client.api.IClientInterceptor
This interceptor adds an arbitrary header to requests made by this client. Both the header name and the header value are specified by the calling code.
See Also:
for a more advanced version of this interceptor which can add multiple headers
  • Constructor Details

    • SimpleRequestHeaderInterceptor

      Constructor
    • SimpleRequestHeaderInterceptor

      public SimpleRequestHeaderInterceptor(String theHeaderName, String theHeaderValue)
      Constructor
      Parameters:
      theHeaderName - The header name, e.g. "Authorization"
      theHeaderValue - The header value, e.g. "Bearer 09uer90uw9yh"
    • SimpleRequestHeaderInterceptor

      public SimpleRequestHeaderInterceptor(String theCompleteHeader)
      Constructor which takes a complete header including name and value
      Parameters:
      theCompleteHeader - The complete header, e.g. "Authorization: Bearer af09ufe90efh". Must not be null or empty.
  • Method Details

    • getHeaderName

    • getHeaderValue

    • interceptRequest

      public void interceptRequest(ca.uhn.fhir.rest.client.api.IHttpRequest theRequest)
      Specified by:
      interceptRequest in interface ca.uhn.fhir.rest.client.api.IClientInterceptor
    • interceptResponse

      public void interceptResponse(ca.uhn.fhir.rest.client.api.IHttpResponse theResponse) throws IOException
      Specified by:
      interceptResponse in interface ca.uhn.fhir.rest.client.api.IClientInterceptor
      Throws:
      IOException
    • setHeaderName

      public void setHeaderName(String theHeaderName)
    • setHeaderValue

      public void setHeaderValue(String theHeaderValue)