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 the SPDYorHTTPHandler 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 a HttpResponse 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 from SpdyServerHandler to HttpStaticFileServerHandler.

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 call operationProgressed function.

Thx dodo.


原文:https://stackoverflow.com/questions/24342830
2022-09-15 08:09

相关文章

更多

Lucene 4.0 发布

Apache项目近日发布了Lucene 4.0版本。 Apache Lucene是一个基于Java的、 ...

solr4.0 id 自动生成

一、配置schema.xml文件 1、添加fieldType <types> & ...

全文搜索服务器 :Solr 4.0

solr是我上周才接触的,一开始的时候很陌生,不知道从哪里开始,我从网上看了很多资料,并加以实践。我一 ...

Apache Solr 4.0 初试体验及LucidWorks介绍

  Apache Solr 4.0 发布一段时间了,最新的solr修改动作还是很大的,尤其从后台管理界 ...

Solr手册(4.0Beta版)

http://lucene.apache.org/solr/4_4_0/tutorial.html的中 ...

Solr手册(4.0Beta版)

概述   这篇文档涵盖了使用示例schema和一些示例数据运行Solr的基础。 必备   为更好fol ...

Netty开发环境配置

最新版本的Netty 4.x和JDK 1.6及更高版本

Solr4.0 如何配置使用UUID自动生成id值

最近学习了Lucene,随便也学习了Solr,Solr规定每一条记录必须有一个主键值,用来唯一标识一条 ...

Solr4.0 如何配置使用UUID自动生成id值

原文链接http://blog.csdn.net/keepthinking_/article/deta ...

IKAnalyzer与solr4.0的整合方法

1 环境配置 Jdk1.6,tomcat6,solr4.0.0,IKAnalyzer 2012FF 2 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本