Chrome net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)

[已解决]net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)。

Solution

For Servlet API

ServletOutputStream writer =cresponse.getOutputStream();
//todo
writer.flush();

For Undertow/XNIO API

try (StreamSinkChannel channel = exchange.getResponseChannel()) {
    channel.write(ByteBuffer.wrap(json.getBytes("UTF-8")));
    channel.flush();
    exchange.endExchange();
   } catch (Exception e) {
    e.printStackTrace();
}