Open etspaceman opened 3 years ago
To make this happen, I think we'd need to understand how they're implemented via a servlet model, and then consider an abstraction that would also fit nicely with forthcoming Ember support. Vault attributes are probably the answer here.
Interesting. Looks like this delegates to Jetty APIs, rather than being a raw servlet solution. That's probably fine, but has impacts on where it lives if we build on it.
I also thought these APIs would be part of Servlet 4/5. I need to make time to read those. The difference between 4 and 5 is the package namespace, but I thought this was a new feature.
To be clear, this is the api I decided on for Embers h2 push promise support.
https://github.com/http4s/http4s/blob/series/0.23/ember-core/shared/src/main/scala/org/http4s/ember/core/h2/H2Keys.scala#L28-L29 - This attaches to a response to push requests out at the same time.
Then in the client, https://github.com/http4s/http4s/blob/series/0.23/ember-client/shared/src/main/scala/org/http4s/ember/client/EmberClientBuilder.scala#L214
It may not be ideal. But its something to work from as a baseline for design.
Ok - that looks like interesting progress for clients. Do you have any thoughts on server support for this?
Ember Server Supports this using that H2Key list there.
So Basically
Response[F](Status.Ok)
.withAttribute(H2Keys.PushPromises, Request[Pure](Method.GET, uri"/foo") :: Nil)
The server then returns that request as a push promise frame, and the server runs that request against its internal routes to generate a response to send normally to the push promises stream identifier.
Jetty supports Push Promises today for Http2 servers. I was in need of this for a project of my own but it doesn't seem that the current Jetty backend supports this today. Created per a conversation w/ @ChristopherDavenport .