Restore changes for 5502. (#5525)
* Restore changes for 5502. * Spotless.
This commit is contained in:
parent
59936ee70c
commit
ec5402abd4
|
@ -105,7 +105,8 @@ public enum Pointcut implements IPointcut {
|
||||||
void.class,
|
void.class,
|
||||||
"ca.uhn.fhir.rest.client.api.IHttpRequest",
|
"ca.uhn.fhir.rest.client.api.IHttpRequest",
|
||||||
"ca.uhn.fhir.rest.client.api.IHttpResponse",
|
"ca.uhn.fhir.rest.client.api.IHttpResponse",
|
||||||
"ca.uhn.fhir.rest.client.api.IRestfulClient"),
|
"ca.uhn.fhir.rest.client.api.IRestfulClient",
|
||||||
|
"ca.uhn.fhir.rest.client.api.ClientResponseContext"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
|
|
@ -36,6 +36,7 @@ import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||||
import ca.uhn.fhir.rest.api.RequestFormatParamStyleEnum;
|
import ca.uhn.fhir.rest.api.RequestFormatParamStyleEnum;
|
||||||
import ca.uhn.fhir.rest.api.SummaryEnum;
|
import ca.uhn.fhir.rest.api.SummaryEnum;
|
||||||
|
import ca.uhn.fhir.rest.client.api.ClientResponseContext;
|
||||||
import ca.uhn.fhir.rest.client.api.IHttpClient;
|
import ca.uhn.fhir.rest.client.api.IHttpClient;
|
||||||
import ca.uhn.fhir.rest.client.api.IHttpRequest;
|
import ca.uhn.fhir.rest.client.api.IHttpRequest;
|
||||||
import ca.uhn.fhir.rest.client.api.IHttpResponse;
|
import ca.uhn.fhir.rest.client.api.IHttpResponse;
|
||||||
|
@ -356,13 +357,20 @@ public abstract class BaseClient implements IRestfulClient {
|
||||||
? ((ResourceResponseHandler<? extends IBaseResource>) binding).getReturnType()
|
? ((ResourceResponseHandler<? extends IBaseResource>) binding).getReturnType()
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
final ClientResponseContext clientResponseContext =
|
||||||
|
new ClientResponseContext(httpRequest, response, this, getFhirContext(), returnType);
|
||||||
HookParams responseParams = new HookParams();
|
HookParams responseParams = new HookParams();
|
||||||
responseParams.add(IHttpRequest.class, httpRequest);
|
responseParams.add(IHttpRequest.class, httpRequest);
|
||||||
responseParams.add(IHttpResponse.class, response);
|
responseParams.add(IHttpResponse.class, response);
|
||||||
responseParams.add(IRestfulClient.class, this);
|
responseParams.add(IRestfulClient.class, this);
|
||||||
|
responseParams.add(ClientResponseContext.class, clientResponseContext);
|
||||||
|
|
||||||
getInterceptorService().callHooks(Pointcut.CLIENT_RESPONSE, responseParams);
|
getInterceptorService().callHooks(Pointcut.CLIENT_RESPONSE, responseParams);
|
||||||
|
|
||||||
|
// Replace the contents of the response with whatever the hook returned, or the same response as before if
|
||||||
|
// it no-op'd
|
||||||
|
response = clientResponseContext.getHttpResponse();
|
||||||
|
|
||||||
String mimeType;
|
String mimeType;
|
||||||
if (Constants.STATUS_HTTP_204_NO_CONTENT == response.getStatus()) {
|
if (Constants.STATUS_HTTP_204_NO_CONTENT == response.getStatus()) {
|
||||||
mimeType = null;
|
mimeType = null;
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
type: add
|
||||||
|
issue: 5502
|
||||||
|
jira: SMILE-7262
|
||||||
|
title: "It is now possible to mutate an HTTP response from the CLIENT_RESPONSE Pointcut, and pass this mutated response
|
||||||
|
to downstream processing."
|
Loading…
Reference in New Issue