use of io.micronaut.http.server.netty.types.stream.NettyStreamedCustomizableResponseType in project micronaut-core by micronaut-projects.
the class StreamTypeHandler method handle.
@Override
public void handle(Object object, HttpRequest<?> request, MutableHttpResponse<?> response, ChannelHandlerContext context) {
NettyStreamedCustomizableResponseType type;
if (object instanceof InputStream) {
type = () -> (InputStream) object;
} else if (object instanceof NettyStreamedCustomizableResponseType) {
type = (NettyStreamedCustomizableResponseType) object;
} else {
throw new CustomizableResponseTypeException("StreamTypeHandler only supports InputStream or StreamedCustomizableResponseType types");
}
type.process(response);
type.write(request, response, context);
context.read();
}
Aggregations