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
Modifier and TypeClassDescriptionstatic class
Contains the results of the capture -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
If the response was a character stream, a character count will be placed in theRequestDetails UserData map
with this key, containing anResponseSizeCapturingInterceptor.Result
value. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncapture
(RequestDetails theRequestDetails, Writer theWriter) void
completed
(RequestDetails theRequestDetails) void
registerConsumer
(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 map
with this key, containing anResponseSizeCapturingInterceptor.Result
value.The value will be placed at the start of the
Pointcut.SERVER_PROCESSING_COMPLETED
pointcut, 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
-