Class AdditionalRequestHeadersInterceptor
- java.lang.Object
-
- ca.uhn.fhir.rest.client.interceptor.AdditionalRequestHeadersInterceptor
-
- All Implemented Interfaces:
ca.uhn.fhir.rest.client.api.IClientInterceptor
public class AdditionalRequestHeadersInterceptor extends Object implements ca.uhn.fhir.rest.client.api.IClientInterceptor
This interceptor adds arbitrary header values to requests made by the client. This is now also possible directly on the Fluent Client API by callingIClientExecutable.withAdditionalHeader(String, String)
-
-
Constructor Summary
Constructors Constructor Description AdditionalRequestHeadersInterceptor()AdditionalRequestHeadersInterceptor(Map<String,List<String>> additionalHttpHeaders)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAllHeaderValues(String headerName, List<String> headerValues)Adds the list of header values for the given header.voidaddHeaderValue(String headerName, String headerValue)Adds the given header value.voidinterceptRequest(ca.uhn.fhir.rest.client.api.IHttpRequest theRequest)Adds the additional header values to the HTTP request.voidinterceptResponse(ca.uhn.fhir.rest.client.api.IHttpResponse theResponse)Does nothing since this interceptor is not concerned with the response.
-
-
-
Constructor Detail
-
AdditionalRequestHeadersInterceptor
public AdditionalRequestHeadersInterceptor()
-
AdditionalRequestHeadersInterceptor
public AdditionalRequestHeadersInterceptor(Map<String,List<String>> additionalHttpHeaders)
-
-
Method Detail
-
addHeaderValue
public void addHeaderValue(String headerName, String headerValue)
Adds the given header value. Note thatheaderNameandheaderValuecannot be null.- Parameters:
headerName- the name of the headerheaderValue- the value to add for the header- Throws:
NullPointerException- if either parameter isnull
-
addAllHeaderValues
public void addAllHeaderValues(String headerName, List<String> headerValues)
Adds the list of header values for the given header. Note thatheaderNameandheaderValuescannot be null.- Parameters:
headerName- the name of the headerheaderValues- the list of values to add for the header- Throws:
NullPointerException- if either parameter isnull
-
interceptRequest
public void interceptRequest(ca.uhn.fhir.rest.client.api.IHttpRequest theRequest)
Adds the additional header values to the HTTP request.- Specified by:
interceptRequestin interfaceca.uhn.fhir.rest.client.api.IClientInterceptor- Parameters:
theRequest- the HTTP request
-
interceptResponse
public void interceptResponse(ca.uhn.fhir.rest.client.api.IHttpResponse theResponse) throws IOException
Does nothing since this interceptor is not concerned with the response.- Specified by:
interceptResponsein interfaceca.uhn.fhir.rest.client.api.IClientInterceptor- Parameters:
theResponse- the HTTP response- Throws:
IOException
-
-