Jetty HTTP2服务器推送支持 [英] Jetty HTTP2 server push support

查看:185
本文介绍了Jetty HTTP2服务器推送支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于SPDY,我们需要实现一个PushStrategy并将其注册以推送资源.

for SPDY, we need to implement a PushStrategy and to register it to push resources.

HTTP2支持如何?

What about HTTP2 support?

我喜欢nginx的想法,该想法包含读取HTTP响应中的链接标头:

I like the idea of nginx which consists to read link header in the HTTP response: https://nghttp2.org/blog/2015/02/10/nghttp2-dot-org-enabled-http2-server-push/

谢谢!

推荐答案

Jetty HTTP/2完全支持HTTP/2 Push,实际上具有不同的风格. Webtide的网站已经启用了Jetty的HTTP/2推送.

Jetty HTTP/2 comes with full support for HTTP/2 Push, in fact in different flavors. Webtide's website already has Jetty's HTTP/2 Push enabled.

有一个

There is a PushCacheFilter, which implements the same algorithm that was implemented in Jetty SPDY's PushStrategy, based on the Referer header.

有一个

There is a PushSessionCacheFilter, which implements a more sophisticated approach using a builder to actually push resources.

现在两者都使用Jetty特定的API,以试图将它们作为Servlet 4.0规范的标准来提出,并在实际示例中进行测试.

Both for now use Jetty specific APIs, in an attempt to propose them as standard for the Servlet 4.0 specification, and have them tested in real world examples.

这种方法的优点是完全自动化,并且不需要应用程序支持:可以与任何旧的或旧版的Webapp一起使用.

The good thing about this approach is that entirely automated, and it does not require the application support: works out of the box with any old/legacy webapps.

Jetty团队当然可以探索使用Link标头的可能性,但这似乎需要应用程序的支持(应用程序必须以正确的格式添加Link标头),以及一个代理层影响表演. https://bugs.eclipse.org/bugs/show_bug.cgi对此进行了跟踪?id = 463457 ,欢迎您提供任何帮助.

The Jetty team can certainly explore the possibility of using the Link header, but that seem to require support from the application (the application has to add the Link header with the right format), and a proxy layer that impacts performances. This is tracked by https://bugs.eclipse.org/bugs/show_bug.cgi?id=463457, any contribution there is welcome.

为了实施自己的策略来推送资源,您可以编写一个简单的Servlet过滤器,然后在其中使用Jetty特定的API(即Dispatcher.push(...)PushBuilder API)来推送自己的资源,类似于上面提到的过滤器的作用.

In order to implement your own strategy to push resources, you can write a simple Servlet Filter, and in there use the Jetty specific API (i.e. Dispatcher.push(...) or the PushBuilder APIs) to push your own resources, similarly to what the above referenced filters do.

这篇关于Jetty HTTP2服务器推送支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆