public class ThreadLocalCapturingInterceptor extends Object implements ca.uhn.fhir.rest.client.api.IClientInterceptor
Use this with caution, since this interceptor does not automatically clean up
the ThreadLocal after setting it. You must make sure to call
clearThreadLocals() after a given request has been completed,
or you will end up leaving stale request/response objects associated
with threads that no longer need them.
for an equivalent interceptor that does not use a ThreadLocal| Constructor and Description |
|---|
ThreadLocalCapturingInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearThreadLocals()
This method should be called at the end of any request process, in
order to clear the last request and response from the current thread.
|
ca.uhn.fhir.rest.client.api.IHttpRequest |
getRequestForCurrentThread() |
ca.uhn.fhir.rest.client.api.IHttpResponse |
getResponseForCurrentThread() |
void |
interceptRequest(ca.uhn.fhir.rest.client.api.IHttpRequest theRequest) |
void |
interceptResponse(ca.uhn.fhir.rest.client.api.IHttpResponse theResponse) |
boolean |
isBufferResponse()
Should we buffer (capture) the response body? This defaults to
false. |
ThreadLocalCapturingInterceptor |
setBufferResponse(boolean theBufferResponse)
Should we buffer (capture) the response body? This defaults to
false. |
public ThreadLocalCapturingInterceptor()
public void clearThreadLocals()
public ca.uhn.fhir.rest.client.api.IHttpRequest getRequestForCurrentThread()
public ca.uhn.fhir.rest.client.api.IHttpResponse getResponseForCurrentThread()
public void interceptRequest(ca.uhn.fhir.rest.client.api.IHttpRequest theRequest)
interceptRequest in interface ca.uhn.fhir.rest.client.api.IClientInterceptorpublic void interceptResponse(ca.uhn.fhir.rest.client.api.IHttpResponse theResponse)
interceptResponse in interface ca.uhn.fhir.rest.client.api.IClientInterceptorpublic boolean isBufferResponse()
false. Set to true if you are planning on
examining response bodies after the response processing is complete.public ThreadLocalCapturingInterceptor setBufferResponse(boolean theBufferResponse)
false. Set to true if you are planning on
examining response bodies after the response processing is complete.Copyright © 2014–2019 University Health Network. All rights reserved.