aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2012-06-18 12:17:25 (EDT)
committerThomas Becker2012-06-18 12:17:25 (EDT)
commitf09eaee52181a65b2614f7c37b0fd304e1c4ee23 (patch)
tree878b5b54381d379bab18e3ab0f52bd2cae66af07
parenta4fb0201f62427e04f51a2ab8f2e01148dddfb12 (diff)
downloadorg.eclipse.jetty.project-f09eaee52181a65b2614f7c37b0fd304e1c4ee23.zip
org.eclipse.jetty.project-f09eaee52181a65b2614f7c37b0fd304e1c4ee23.tar.gz
org.eclipse.jetty.project-f09eaee52181a65b2614f7c37b0fd304e1c4ee23.tar.bz2
spdy: push strategy move if-modified-since check from connection to ReferrerPushStrategyrefs/changes/25/6425/1
-rw-r--r--jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java23
-rw-r--r--jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java7
2 files changed, 15 insertions, 15 deletions
diff --git a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java
index 52f1243..57f3e32 100644
--- a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java
+++ b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java
@@ -104,16 +104,16 @@ public class ReferrerPushStrategy implements PushStrategy
@Override
public Set<String> apply(Stream stream, Headers requestHeaders, Headers responseHeaders)
{
- Set<String> result = Collections.emptySet();
+ Set<String> result = Collections.<String>emptySet();
short version = stream.getSession().getVersion();
- String scheme = requestHeaders.get(HTTPSPDYHeader.SCHEME.name(version)).value();
- String host = requestHeaders.get(HTTPSPDYHeader.HOST.name(version)).value();
- String origin = new StringBuilder(scheme).append("://").append(host).toString();
- String url = requestHeaders.get(HTTPSPDYHeader.URI.name(version)).value();
- String absoluteURL = new StringBuilder(origin).append(url).toString();
- logger.debug("Applying push strategy for {}", absoluteURL);
- if (isValidMethod(requestHeaders.get(HTTPSPDYHeader.METHOD.name(version)).value()))
+ if (!isIfModifiedSinceHeaderPresent(requestHeaders) && isValidMethod(requestHeaders.get(HTTPSPDYHeader.METHOD.name(version)).value()))
{
+ String scheme = requestHeaders.get(HTTPSPDYHeader.SCHEME.name(version)).value();
+ String host = requestHeaders.get(HTTPSPDYHeader.HOST.name(version)).value();
+ String origin = new StringBuilder(scheme).append("://").append(host).toString();
+ String url = requestHeaders.get(HTTPSPDYHeader.URI.name(version)).value();
+ String absoluteURL = new StringBuilder(origin).append(url).toString();
+ logger.debug("Applying push strategy for {}", absoluteURL);
if (isMainResource(url, responseHeaders))
{
result = pushResources(absoluteURL);
@@ -131,11 +131,16 @@ public class ReferrerPushStrategy implements PushStrategy
result = pushResources(absoluteURL);
}
}
+ logger.debug("Push resources for {}: {}", absoluteURL, result);
}
- logger.debug("Push resources for {}: {}", absoluteURL, result);
return result;
}
+ private boolean isIfModifiedSinceHeaderPresent(Headers headers)
+ {
+ return headers.get("if-modified-since") != null;
+ }
+
private boolean isValidMethod(String method)
{
return "GET".equalsIgnoreCase(method);
diff --git a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java
index 5fb09f5..b4e278f 100644
--- a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java
+++ b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java
@@ -403,7 +403,7 @@ public class ServerHTTPSPDYAsyncConnection extends AbstractHttpConnection implem
if (!stream.isUnidirectional())
stream.reply(replyInfo);
if (replyInfo.getHeaders().get(HTTPSPDYHeader.STATUS.name(version)).value().startsWith("200") &&
- !stream.isClosed() && !isIfModifiedSinceHeaderPresent())
+ !stream.isClosed())
{
// We have a 200 OK with some content to send
@@ -438,11 +438,6 @@ public class ServerHTTPSPDYAsyncConnection extends AbstractHttpConnection implem
}
}
- private boolean isIfModifiedSinceHeaderPresent()
- {
- return headers.get("if-modified-since") != null;
- }
-
private Buffer consumeContent(long maxIdleTime) throws IOException, InterruptedException
{
while (true)