Search code examples
springspring-boothttp2

Spring Boot HTTP2 Server Push


Found the nice example from Brian Clozel about HTTP/2 and Spring Boot, especially with Server Push: https://github.com/bclozel/http2-experiments. There is an index.html which has some image resources. However, those image are pushed to the server, but I have no idea where exactly this push is initiated from. I don't see any push filters or any other indicators which could lead to push the resources inside the index.html. Any ideas?


Solution

  • Jetty's PushCacheFilter is configured here in the example.

    PushCacheFilter will automatically "learn" what secondary resources are associated to any resource, and will automatically push them.

    The example also shows a way to programmatically push a resource. However, that API has been deprecated in favor of using a PushBuilder.

    PushBuilder will be part of Servlet 4.0, becoming a standard API.