for SPDY, we need to implement a PushStrategy and to register it to push resources.
What about HTTP2 support?
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/
Thanks!
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.