1 // 2 // ======================================================================== 3 // Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd. 4 // ------------------------------------------------------------------------ 5 // All rights reserved. This program and the accompanying materials 6 // are made available under the terms of the Eclipse Public License v1.0 7 // and Apache License v2.0 which accompanies this distribution. 8 // 9 // The Eclipse Public License is available at 10 // http://www.eclipse.org/legal/epl-v10.html 11 // 12 // The Apache License v2.0 is available at 13 // http://www.opensource.org/licenses/apache2.0.php 14 // 15 // You may elect to redistribute this code under either of these licenses. 16 // ======================================================================== 17 // 18 19 20 package org.eclipse.jetty.spdy.server.http; 21 22 import java.util.Collections; 23 import java.util.Set; 24 25 import org.eclipse.jetty.spdy.api.Stream; 26 import org.eclipse.jetty.util.Fields; 27 28 /** 29 * <p>{@link PushStrategy} encapsulates the decisions about performing 30 * SPDY pushes of secondary resources associated with a primary resource.</p> 31 */ 32 public interface PushStrategy 33 { 34 /** 35 * <p>Applies the SPDY push logic for the primary resource.</p> 36 * 37 * @param stream the primary resource stream 38 * @param requestHeaders the primary resource request headers 39 * @param responseHeaders the primary resource response headers 40 * @return a list of secondary resource URIs to push 41 */ 42 public Set<String> apply(Stream stream, Fields requestHeaders, Fields responseHeaders); 43 44 /** 45 * An implementation that returns an empty list of secondary resources 46 */ 47 public static class None implements PushStrategy 48 { 49 @Override 50 public Set<String> apply(Stream stream, Fields requestHeaders, Fields responseHeaders) 51 { 52 return Collections.emptySet(); 53 } 54 } 55 }