Improved push of resources by executing them in a different thread.\nAdded a HTTP header that signal to the application that the HTTP request is actually a push.
This commit is contained in:
parent
51f307ca7c
commit
e328cb8141
|
@ -421,6 +421,7 @@ public class ServerHTTPSPDYAsyncConnection extends AbstractHttpConnection implem
|
|||
pushHeaders.put(scheme);
|
||||
pushHeaders.put(host);
|
||||
pushHeaders.put("referer", referrer);
|
||||
pushHeaders.put("x-spdy-push", "true");
|
||||
// Remember support for gzip encoding
|
||||
pushHeaders.put(headers.get("accept-encoding"));
|
||||
stream.syn(new SynInfo(pushHeaders, false), getMaxIdleTime(), TimeUnit.MILLISECONDS, new Handler.Adapter<Stream>()
|
||||
|
@ -428,7 +429,8 @@ public class ServerHTTPSPDYAsyncConnection extends AbstractHttpConnection implem
|
|||
@Override
|
||||
public void completed(Stream pushStream)
|
||||
{
|
||||
Synchronous pushConnection = new Synchronous(getConnector(), getEndPoint(), getServer(), version, connection, pushStrategy, pushStream);
|
||||
ServerHTTPSPDYAsyncConnection pushConnection =
|
||||
new ServerHTTPSPDYAsyncConnection(getConnector(), getEndPoint(), getServer(), version, connection, pushStrategy, pushStream);
|
||||
pushConnection.beginRequest(pushHeaders, true);
|
||||
}
|
||||
});
|
||||
|
@ -767,18 +769,4 @@ public class ServerHTTPSPDYAsyncConnection extends AbstractHttpConnection implem
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class Synchronous extends ServerHTTPSPDYAsyncConnection
|
||||
{
|
||||
private Synchronous(Connector connector, AsyncEndPoint endPoint, Server server, short version, SPDYAsyncConnection connection, PushStrategy pushStrategy, Stream stream)
|
||||
{
|
||||
super(connector, endPoint, server, version, connection, pushStrategy, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(Runnable task)
|
||||
{
|
||||
task.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue