Netty 4.0 SPDY文件传输无法正常工作(Netty 4.0 SPDY file transfer not working)
很长一段时间,当我尝试使用带有netty的SPDY时,我总是遇到同样的麻烦。
我检查了不同的SPDY源来设置我的SPDY服务器。 到目前为止它工作正常,我的浏览器有一个纯html输出。 Chrome还会显示一个spdy会话。
问题
当我将netty 4
SPDYorHTTPHandler
示例类放到SPDYorHTTPHandler
我总是遇到同样的问题。发送HTML内容,但文件内容不发送。 处理程序正在发送响应,以便我的客户端检索,但随后文件永远不会传输。
关于那个的任何想法?
ctx.write(response)
正在将响应写入客户端(响应是一个HttpResponse
obj)。在下一行:(
raf=RandomAccessFile
)ChannelFuture sendFileFuture; if (useSendFile) { sendFileFuture = ctx.write(new DefaultFileRegion(raf.getChannel(), 0, fileLength), ctx.newProgressivePromise()); } else { sendFileFuture = ctx.write(new ChunkedFile(raf, 0, fileLength, 8192), ctx.newProgressivePromise()); }
但它永远不会写。 代码基于
HttpStaticFileServerHandler
示例和netty 4的SPDY示例100%。我刚刚将
createHttpRequestHandlerForHttp output
更改为createHttpRequestHandlerForHttp output
。这是我使用的桩线:
ChannelPipeline pipeline = ctx.pipeline(); pipeline.addLast("spdyFrameCodec", new SpdyFrameCodec(version)); pipeline.addLast("spdySessionHandler", new SpdySessionHandler(version,true)); pipeline.addLast("spdyHttpEncoder", new SpdyHttpEncoder(version)); pipeline.addLast("spdyHttpDecoder", new SpdyHttpDecoder(version, MAX_CONTENT_LENGTH)); pipeline.addLast("spdyStreamIdHandler", new SpdyHttpResponseStreamIdHandler()); pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); pipeline.addLast("httpRequestHandler",new HttpStaticFileServerHandler());
如果您需要更多代码,请写,我将扩展Post。
我没有错误,警告或其他。
ChannelProgressiveFutureListener
从未调用operationProgressed
函数。Thx渡渡鸟。
For a long time I always run into the same trouble when i try to use SPDY with netty.
I checked different SPDY sources to setup my SPDY server. So far it works fine and I have got a pure html output in my browser. Chrome also shows an spdy session.
Issue
When i put the netty 4
HttpStaticFileServerHandler
example class to theSPDYorHTTPHandler
I always run into the same problem.HTML content is sent, but the file content isn't. The handler is sending the response so my client retrieves, but then the files are never transmitted.
Any ideas about that?
ctx.write(response)
is writing the response to the client (response is aHttpResponse
obj).In the next line:(
raf=RandomAccessFile
)ChannelFuture sendFileFuture; if (useSendFile) { sendFileFuture = ctx.write(new DefaultFileRegion(raf.getChannel(), 0, fileLength), ctx.newProgressivePromise()); } else { sendFileFuture = ctx.write(new ChunkedFile(raf, 0, fileLength, 8192), ctx.newProgressivePromise()); }
But it never gets written. The code based 100% on the
HttpStaticFileServerHandler
example and the SPDY example of netty 4.I just changed the
createHttpRequestHandlerForHttp output
fromSpdyServerHandler
toHttpStaticFileServerHandler
.This is the pileline I use:
ChannelPipeline pipeline = ctx.pipeline(); pipeline.addLast("spdyFrameCodec", new SpdyFrameCodec(version)); pipeline.addLast("spdySessionHandler", new SpdySessionHandler(version,true)); pipeline.addLast("spdyHttpEncoder", new SpdyHttpEncoder(version)); pipeline.addLast("spdyHttpDecoder", new SpdyHttpDecoder(version, MAX_CONTENT_LENGTH)); pipeline.addLast("spdyStreamIdHandler", new SpdyHttpResponseStreamIdHandler()); pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); pipeline.addLast("httpRequestHandler",new HttpStaticFileServerHandler());
If you need more code for that, just write, I will extend the Post.
I got no errors, warnings or something else.
A
ChannelProgressiveFutureListener
did never calloperationProgressed
function.Thx dodo.
原文:https://stackoverflow.com/questions/24342830
相关文章
更多Lucene 4.0 发布
solr4.0 id 自动生成
全文搜索服务器 :Solr 4.0
Apache Solr 4.0 初试体验及LucidWorks介绍
Solr手册(4.0Beta版)
Solr手册(4.0Beta版)
Netty开发环境配置
Solr4.0 如何配置使用UUID自动生成id值
Solr4.0 如何配置使用UUID自动生成id值
IKAnalyzer与solr4.0的整合方法
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!