Class ResponseLifecycle
java.lang.Object
io.micronaut.http.server.ResponseLifecycle
-
Constructor Summary
ConstructorsConstructorDescriptionResponseLifecycle(RouteExecutor routeExecutor, MessageBodyHandlerRegistry messageBodyHandlerRegistry, ConversionService conversionService, ByteBodyFactory byteBodyFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected CloseableByteBodyconcatenate(Publisher<ByteBody> items) protected CloseableByteBodyconcatenateJson(Publisher<ByteBody> items) final ExecutionFlow<? extends ByteBodyHttpResponse<?>> encodeHttpResponseSafe(HttpRequest<?> httpRequest, HttpResponse<?> response) Encode the response.protected ExecutionFlow<? extends ByteBodyHttpResponse<?>> encodeNoBody(HttpResponse<?> response) Encode the given response without body, either because it has none or because this is a HEAD response.protected final ExecutionFlow<? extends ByteBodyHttpResponse<?>> handleStreamingError(HttpRequest<?> request, Throwable t) Handle an error that happened before the first item of a streaming response.protected abstract ExecutorThe IO executor for blocking writers.protected <T> ResponseBodyWriter<T> wrap(MessageBodyWriter<T> messageBodyWriter) Transform the given writer into aResponseBodyWriter.
-
Constructor Details
-
ResponseLifecycle
public ResponseLifecycle(RouteExecutor routeExecutor, MessageBodyHandlerRegistry messageBodyHandlerRegistry, ConversionService conversionService, ByteBodyFactory byteBodyFactory)
-
-
Method Details
-
ioExecutor
The IO executor for blocking writers.- Returns:
- The blocking executor
-
wrap
Transform the given writer into aResponseBodyWriter.- Type Parameters:
T- The writer type- Parameters:
messageBodyWriter- The writer- Returns:
- The response writer
-
encodeHttpResponseSafe
public final ExecutionFlow<? extends ByteBodyHttpResponse<?>> encodeHttpResponseSafe(HttpRequest<?> httpRequest, HttpResponse<?> response) Encode the response.- Parameters:
httpRequest- The request that triggered this responseresponse- The unencoded response- Returns:
- The encoded response
-
encodeNoBody
Encode the given response without body, either because it has none or because this is a HEAD response.- Parameters:
response- The response- Returns:
- The encoded response
-
concatenate
- Parameters:
items- The items- Returns:
- The concatenated body
- See Also:
-
concatenateJson
- Parameters:
items- The items- Returns:
- The concatenated body
- See Also:
-
handleStreamingError
protected final ExecutionFlow<? extends ByteBodyHttpResponse<?>> handleStreamingError(HttpRequest<?> request, Throwable t) Handle an error that happened before the first item of a streaming response.- Parameters:
request- The requestt- The error- Returns:
- The encoded error response
-