将Jetty / Jersey堆栈迁移到Http2

时间:2019-07-04 19:49:52

标签: jersey jetty jersey-2.0 embedded-jetty http2

我有一个现有的应用程序,该应用程序带有嵌入式码头和运动衫,我希望对其进行较小的修改即可使其成为http2。当前代码如下:

    Server jettyServer = new Server(9998);

    ServletHolder jerseyServlet = context.addServlet( org.glassfish.jersey.servlet.ServletContainer.class, "/*");

    jerseyServlet.setInitOrder(0);

    jerseyServlet.setInitParameter( "jersey.config.server.provider.classnames",MyServerConfig.class.getCanonicalName());

    jettyServer.setHandler(context);

    jettyServer.start(); 

这是我的POM

       <dependency>
            <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>9.4.15.v20190215</version>
        </dependency>
       <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-servlet</artifactId>
            <version>9.4.15.v20190215</version>
        </dependency>   
       <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-servlets</artifactId>
            <version>9.4.15.v20190215</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <version>2.26</version>
    </dependency> 
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
        <version>2.26</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
        <version>2.26</version>
    </dependency>

要使其变为Http2,我需要更改什么?

0 个答案:

没有答案