HTTP/2 Java 8, Jetty and ALPN

假装没事ソ 提交于 2019-12-03 21:22:32

Jetty's ALPN boot jar works with both OpenJDK and Oracle's JDK (which is based on OpenJDK).

Jetty's ALPN boot jar must be in the boot classpath, not the regular classpath, like the documentation you linked says.

As such, you must not declare it as a dependency in your pom.xml files (there is no need to, like there is no need for you to specify a dependency on the JDK classes).

JDK 9 will have ALPN support native, there is already some work in that direction.

Netty is preferred for several reasons for making Http/2 connections. Few advantages I have seen using it are :

  • No need for the ALPN jar to be added to the boot classpath. Adding maven dependency "netty-tcnative-boringssl-static" does the job
  • It inherently support a asynchronous model of using the API. Hence it makes it simpler to handle data pushed by the server in case of HTTP/2
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!