我有netty应用程序,该请求由jersey 1.0资源处理,并在处理后将内容写回到netty频道。
我的代码在github here中。
通过入站处理程序here读取对netty的http请求,并将以下消息打印到控制台。
request received
HttpObjectAggregator$AggregatedFullHttpRequest(decodeResult: success, version: HTTP/1.1, content: CompositeByteBuf(ridx: 0, widx: 0, cap: 0, components=0))
GET /hellonetty HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: _ga=GA1.1.1996916298.1541452253; _gid=GA1.1.1674341523.1543246307
spf-debug: 3
spf-referrer: https://www.superchevy.com/features/1809-test-lab-61-did-gm-let-1963-corvette-slip-away/
spf-ip: 38.97.88.235
content-length: 0
我还将响应写回到通道here。 这也将立即写入控制台。
in response writer respone DefaultFullHttpResponse(decodeResult: success, version: HTTP/1.1, content: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 0, widx: 11, cap: 64))
HTTP/1.1 200 OK
Content-Type: text/plain
但是该响应未在浏览器中显示,并且浏览器仍在程序中显示。 当我停止netty-jersey1 java program时,响应会立即显示在chrome浏览器中。
任何想法我为什么要面对这种奇怪的行为。 我的编码有什么问题?