public static void beginHTTPResponse(ChannelHandlerContext ctx, FullHttpRequest request, long lastModified,
String path, long fileLength) {
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
HttpUtil.setContentLength(response, fileLength);
setContentTypeHeader(response, path);
response.headers().set(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED);
setDateAndCacheHeaders(response, lastModified);
if (HttpUtil.isKeepAlive(request)) {
response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
}
// Write the initial line and the header.
ctx.write(response);
}
HttpStaticFileServerHandler.java 文件源码
java
阅读 70
收藏 0
点赞 0
评论 0
项目:NettyStages
作者:
评论列表
文章目录