Class AdditionalRequestHeadersInterceptor
java.lang.Object
ca.uhn.fhir.rest.client.interceptor.AdditionalRequestHeadersInterceptor
This interceptor adds arbitrary header values to requests made by the client.
This is now also possible directly on the Fluent Client API by calling
IClientExecutable.withAdditionalHeader(String, String)
-
Constructor Summary
ConstructorDescriptionConstructorAdditionalRequestHeadersInterceptor
(Map<String, List<String>> theHeaders) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllHeaderValues
(String headerName, List<String> headerValues) Adds the list of header values for the given header.void
addHeaderValue
(String headerName, String headerValue) Adds the given header value.void
interceptRequest
(ca.uhn.fhir.rest.client.api.IHttpRequest theRequest) Adds the additional header values to the HTTP request.
-
Constructor Details
-
AdditionalRequestHeadersInterceptor
public AdditionalRequestHeadersInterceptor()Constructor -
AdditionalRequestHeadersInterceptor
Constructor- Parameters:
theHeaders
- The additional headers to add to every request
-
-
Method Details
-
addHeaderValue
Adds the given header value. Note thatheaderName
andheaderValue
cannot be null.- Parameters:
headerName
- the name of the headerheaderValue
- the value to add for the header- Throws:
NullPointerException
- if either parameter isnull
-
addAllHeaderValues
Adds the list of header values for the given header. Note thatheaderName
andheaderValues
cannot 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
Adds the additional header values to the HTTP request.- Parameters:
theRequest
- the HTTP request
-