First, some basic points:
- You must use Servlet 4.0 to implement server push. The API does not exist in earlier versions such as 3.1.
- The Servlet Specification is now under the umbrella of Java EE ("Jakarata EE"), and the Servlet 4.0 specification is part of Java EE 8.
- Therefore, to implement server push in a servlet you must use EE 8. You can't use EE 7.
- However, you can use JDK 8 or greater with EE 8. There is no need to go to JDK 9.
- Tomcat provides a useful table for correlating any Tomcat version with supported Java and servlet versions.
- The following servers support Java EE 8: GlassFish 5.x, Payara 5.x and Tomcat 9.x. You can't use Tomcat 8.5.
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:
- is binary, instead of textual
- is fully multiplexed, instead of ordered and blocking
- can therefore use one connection for parallelism
- uses header compression to reduce overhead
- allows servers to “push” responses proactively into client caches
Finally, there are also a few related matters worth noting:
- While HTTP/2 itself does not require the use of https, as a practical matter it is required since "currently no browser supports HTTP/2 unencrypted".
- All popular browsers already fully support HTTP/2.
- As far as I know there is nothing that prevents the use of any of the major IDEs (Intellij IDEA, Eclipse, STS, NetBeans) for developing and testing HTTP/2 functionality.