Reputation: 4636
I'm doing some research on HTTP2 and the possibility of us using it in our application. At the moment we are developing in Java 8 and use Tomcat 8.5.24 (this means we use Servlet 3.1). I have scoured the web but could not find any resources as to how to leverage the HTTP2 capabilities.
The only examples I could find were using Servlet 4.0 (which from what I saw is only supported by Tomcat 9) and the only thing that was showcased was the use of a PushBuilder
to push css and js files when a client requests and html page.
Will I be able to use the Asynchronous api provided by Servlet 3.1 over HTTP2? Is HTTP2 supported by Servlet 3.1? If not, what's the point of Tomcat 8.5 supporting HTTP2? Only for pushing web resources?
Upvotes: 3
Views: 6024
Reputation: 17343
First, some basic points:
To address your specific questions:
Will I be able to use the Asynchronous api provided by Servlet 3.1 over HTTP2?
Yes. It's still there is the 4.0 specification.
Is HTTP2 supported by Servlet 3.1?
No. Appendix A1 of the Servlet 4.0 specification explicitly states that one change from 3.1 is the "Requirement to support HTTP/2".
If not, what's the point of Tomcat 8.5 supporting HTTP2?
Because there are features in HTTP/2 that exist independently of servlets. See the Tomcat 8.5 documentation on its HTTP/2 support. For example, while you could not implement HTTP/2 server push, you could still implement HTTP/2 header compression using Tomcat 8.5.
Only for pushing web resources?
No. HTTP/2 is all about performance, and server push is just one feature:
Finally, there are also a few related matters worth noting:
Upvotes: 6