public class ReferrerPushStrategy extends Object implements PushStrategy
A SPDY push strategy that auto-populates push metadata based on referrer URLs.
A typical request for a main resource such as index.html is immediately followed by a number of requests for associated resources. Associated resource requests will have a Referer HTTP header that points to index.html, which we use to link the associated resource to the main resource.
However, also following a hyperlink generates a HTTP request with a Referer HTTP header that points to index.html; therefore main resources and associated resources must be distinguishable.
This class distinguishes associated resources by their URL path suffix. CSS stylesheets, images and JavaScript files have recognizable URL path suffixes that are classified as associated resources.
Note however, that CSS stylesheets may refer to images, and the CSS image request will have the CSS stylesheet as referrer, so there is some degree of recursion that needs to be handled.
TODO: this class is kind-of leaking since the resources map is always adding entries TODO: although these entries will be limited by the number of application pages. TODO: however, there is no ConcurrentLinkedHashMap yet in JDK (there is in Guava though) TODO: so we cannot use the built-in LRU features of LinkedHashMap TODO: Wikipedia maps URLs like http://en.wikipedia.org/wiki/File:PNG-Gradient_hex.png TODO: to text/html, so perhaps we need to improve isPushResource() by looking at the TODO: response Content-Type header, and not only at the URL extensionPushStrategy.None
Constructor and Description |
---|
ReferrerPushStrategy() |
ReferrerPushStrategy(List<String> pushRegexps) |
ReferrerPushStrategy(List<String> pushRegexps,
List<String> allowedPushOrigins) |
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.