Jetty HTTP2 server push support

穿精又带淫゛_ 提交于 2019-12-01 20:08:23

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.

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.

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!