Jetty Logo
Version: 9.1.3-SNAPSHOT
Contact the core Jetty developers at www.webtide.com

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery

Implement a custom SPDY PushStrategy

PushStrategy API
ReferrerPushStrategy

The ReferrerPushStrategy that is distributed with Jetty (Configuring SPDY push) does a great job to automatically detect subresources to push for a given main resource. However there might be reasons to implement your own push strategy.

PushStrategy API

The interface that needs to be implemented isPushStrategy. For each request Jetty will call the apply method, which will return a Set with the resources to push. This is the apply method's signature:

The parameters are the Stream for the primary resource request, the request and the response header fields. Based on this information the implementation has to decide which resources to push and return a Set<String> containing the URLs for the resources to push. Jetty will then open a push stream for each URL returned in that list and push the contents of that file. This is the only method that you need to implement.

ReferrerPushStrategy

For reference and as a working example use the ReferrerPushStrategy source code:

See an error or something missing? Contribute to this documentation at Github!(Generated: 2014-04-15T11:43:41-05:00)