
Class ResponseSizeCapturingInterceptor
java.lang.Object
ca.uhn.fhir.rest.server.interceptor.ResponseSizeCapturingInterceptor
This interceptor captures and makes
available the number of characters written (pre-compression if Gzip compression is being used) to the HTTP response
stream for FHIR responses.
Response details are made available in the request RequestDetails UserData map
with RESPONSE_RESULT_KEY as the key.
- Since:
- 5.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classContains the results of the capture -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringIf the response was a character stream, a character count will be placed in theRequestDetails UserData mapwith this key, containing anResponseSizeCapturingInterceptor.Resultvalue. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncapture(RequestDetails theRequestDetails, Writer theWriter) voidcompleted(RequestDetails theRequestDetails) voidregisterConsumer(Consumer<ResponseSizeCapturingInterceptor.Result> theConsumer) Registers a new consumer.
-
Field Details
-
RESPONSE_RESULT_KEY
If the response was a character stream, a character count will be placed in theRequestDetails UserData mapwith this key, containing anResponseSizeCapturingInterceptor.Resultvalue.The value will be placed at the start of the
Pointcut.SERVER_PROCESSING_COMPLETEDpointcut, so it will not be available before that time.
-
-
Constructor Details
-
ResponseSizeCapturingInterceptor
public ResponseSizeCapturingInterceptor()
-
-
Method Details
-
capture
-
completed
-
registerConsumer
public void registerConsumer(@Nonnull Consumer<ResponseSizeCapturingInterceptor.Result> theConsumer) Registers a new consumer. All consumers will be notified each time a request is complete.- Parameters:
theConsumer- The consumer
-