HTTP / 2 Java 8,Jetty和ALPN [英] HTTP/2 Java 8, Jetty and ALPN

查看:317
本文介绍了HTTP / 2 Java 8,Jetty和ALPN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过这个页面: https:// www。 eclipse.org/jetty/documentation/9.3.x/alpn-chapter.html 在我的类路径中有一个ALPN引导jar但仍然无法使其工作。

I went thru this page: https://www.eclipse.org/jetty/documentation/9.3.x/alpn-chapter.html to have an ALPN boot jar in my classpath and still I can't get it working.

我很困惑知道我是否需要Open SDK Java 8而不是Oracle Java 8.

I am confused as to know if I need an Open SDK Java 8 than Oracle Java 8.

我的Java版本是:

java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

我正在使用以下版本的Jetty和ALPN启动:

And I'm using the following versions of Jetty and ALPN boot:

<jetty-version>9.4.0.M1</jetty-version>
<alpn-version>8.1.9.v20160720</alpn-version>    
<dependency>
        <groupId>org.mortbay.jetty.alpn</groupId>
        <artifactId>alpn-boot</artifactId>
        <version>${alpn-version}</version>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-client</artifactId>
    <version>${jetty-version}</version>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty.http2</groupId>
    <artifactId>http2-client</artifactId>
    <version>${jetty-version}</version>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty.http2</groupId>
    <artifactId>http2-http-client-transport</artifactId>
    <version>${jetty-version}</version>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty.http2</groupId>
    <artifactId>http2-common</artifactId>
    <version>${jetty-version}</version>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty.http2</groupId>
    <artifactId>http2-hpack</artifactId>
    <version>${jetty-version}</version>
</dependency>

此外,我尝试使用不同版本的Jetty和ALPN,我在这里找到 https://mvnrepository.com/artifact/org.mortbay.jetty.alpn/alpn-boot https://mvnrepository.com/search?q=org.eclipse.jetty

Also I tried using different versions of Jetty and ALPN which I found here https://mvnrepository.com/artifact/org.mortbay.jetty.alpn/alpn-boot and here https://mvnrepository.com/search?q=org.eclipse.jetty

无论我尝试哪种方式,我都没有把它提交到HTTP / 2端点的POST请求。

Whichever ways I tried I never got it working submitting a POST request to an HTTP/2 endpoint.

然而,对于Netty和以下依赖,我的测试成功:

However with Netty and the following dependency my tests were successful:

<dependency>
           <groupId>io.netty</groupId>
           <artifactId>netty-tcnative-boringssl-static</artifactId>
           <version>1.1.33.Fork22</version>
       </dependency>

在哪里可以找到文档,看看哪个版本的ALPN启动与Oracle JDK兼容?
ALPN启动是否只与OpenJDK兼容?

Where do I find the documentation to see which version of ALPN boot is compatible with Oracle JDK? Is ALPN boot only compatible with OpenJDK?

我读到启动Java 9对ALPN的支持将是原生的。

I read that starting Java 9 support for ALPN will be native.

在附注中,哪一个更好?用于HTTP / 2调用的Netty或Jetty。

On a side note, which one is better? Netty or Jetty for HTTP/2 calls.

推荐答案

出于几个原因,建立Http / 2连接是首选Netty。我使用它的几个优点是:

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


  • 不需要将ALPN jar添加到引导类路径中。添加maven依赖netty-tcnative-boringssl-static完成工作

  • 它本身支持使用API​​的异步模型。因此,在HTTP / 2

这篇关于HTTP / 2 Java 8,Jetty和ALPN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆