将Jetty 8升级到Jetty 9 [英] Upgrading Jetty 8 to Jetty 9

查看:1496
本文介绍了将Jetty 8升级到Jetty 9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从码头8升级到码头9,并遇到了一些API中有关编译失败的问题.

I am upgrading from jetty 8 to jetty 9 and have come across some issues around compilation failures within some APIs.

SslSelectChannelConnector已被删除,从我可以看到的带有secureRequestCustomizer的httpConfiguration替换了它.

The SslSelectChannelConnector has been removed and from what I can see httpConfiguration with secureRequestCustomizer replaces this.

但是我都找不到很多方法.例如

But there are many methods that I cant find on both. For example

setRequestBufferSize

setRequestBufferSize

setResponseBufferSize

setResponseBufferSize

setAcceptors

setAcceptors

setMaxIdleTime

setMaxIdleTime

SessionHandler不再具有getSessionManager()方法.

SessionHandler no longer has a getSessionManager() method.

此外,queueThreadPool不再具有setMaxQueued(int),并且JettyServer不再具有以下两种方法: setThreadPool(QueueThreadPool) setGracefulShutdown(int)

Also the queueThreadPool no longer has a setMaxQueued(int ), and JettyServer no longer has these two methods: setThreadPool(QueueThreadPool) setGracefulShutdown(int)

不推荐使用SslSelectChannelConnector.将SelectChannelConnector与SslContextFactory一起使用.

SslSelectChannelConnector Deprecated. use SelectChannelConnector with SslContextFactory.

jettyServer.setThreadPool(threadPool);  // --> threadPool is set in the constructor new Server(QueueThreadPool)
jettyServer.setGracefulShutdown(5000);  // --> jettyServer.setStopTimeout(5000);
jettyServer.setConnectors(new Connector[] { connector });  // -->  ServerConnector which takes https_config
jettyServer.setSendServerVersion(false); // -->  https_config.setSendServerVersion(false);

在何处或使用哪个API代替上述内容?

Where or which API is used in place of the above?

还有一些自定义内容在运行时停止工作,找不到/看不到.

Also is there any custom stuff that stopped working at runtime, that isn't obvious to find/see.

推荐答案

提醒:Jetty版本控制(自1995年开始)是<servlet_support>.<major_version>.<minor_version>

Reminder: Jetty versioning (since 1995) is <servlet_support>.<major_version>.<minor_version>

您正在将主要版本从8.1升级到9.4(这是6个主要版本!).因此,您会看到大量的变化.

You are doing a major version upgrade from 8.1 to 9.4 (which is 6 major versions!). You are seeing a massive amount of change as a result of this.

SslSelectChannelConnector已被删除,从我可以看到的带有secureRequestCustomizer的httpConfiguration替换了它.

The SslSelectChannelConnector has been removed and from what I can see httpConfiguration with secureRequestCustomizer replaces this.

欢迎来到协议的新世界.

Welcome to the new world of protocols.

不再有协议专用连接器的概念.

There is no longer any concept of protocol specific connectors.

ServerConnector是连接器,它没有协议知识,也不需要它.它只是服务器的连接点(甚至不是特定于TCP/IP的连接,例如也可以是Unix套接字).

ServerConnector is the connector, it has no protocol knowledge, nor needs it. It simply is a connection point (not even TCP/IP specific, it could be Unix Sockets for example) to the server.

它的配置,确定连接类型,绑定位置以及客户端连接到该端口后如何协商协议.

The configuration of it, determines the connection type, where it binds, and how the protocol is negotiated once the client connects to that port.

ConnectionFactory确定.

HttpConfiguration确定HTTP级别行为的功能.

The HttpConfiguration determines how the HTTP level behavior functions.

有关说明,请参见: https://stackoverflow.com/a/30191878/775715 .

请参阅:有关更多示例,请参见: embedded-jetty-cookbook .

See: embedded-jetty-cookbook for more examples.

但是我都找不到很多方法.例如

But there are many methods that I cant find on both. For example

setRequestBufferSize

setRequestBufferSize

不再存在,它与SPDY和HTTP/2不兼容

This doesn't exist anymore, it was incompatible with SPDY and HTTP/2

请参见

See HttpConfiguration.setRequestHeaderSize(int) for controlling the maximum request header size.

注意:如果您使用的是HTTP/2,我们建议您不要将请求标头的大小调整为大于默认值(出于协议兼容性的原因).

setResponseBufferSize

setResponseBufferSize

此功能已不存在,它与SPDY和HTTP/2不兼容.

This doesn't exist anymore, it was incompatible with SPDY and HTTP/2.

请参见

See HttpConfiguration.setResponseHeaderSize(int) for controlling the maximum response header size.

注意:如果您使用的是HTTP/2,我们建议您不要将响应头的大小调整为大于默认值(出于协议兼容性的原因).

请参见

See HttpConfiguration.setOutputBufferSize(int) for output buffer aggregation controls. (has little meaning in HTTP/2, is really only relevant for HTTP/1.x)

setAcceptors

setAcceptors

请参阅

See the various constructors for ServerConnector, there are no setters for these.

setMaxIdleTime

setMaxIdleTime

您可以使用许多空闲超时设置(例如:连接器,连接,端点,线程,线程池,AsyncContext,读取,写入,websocket会话等)

There are many idle timeout settings available to you (eg: connector, connection, endpoint, thread, threadpool, AsyncContext, read, write, websocket session, etc ...)

根据您的问题,以下是一些相关的示例.

Here's a few examples that seem relevant based on your questions.

请参见请参见请参见 QueuedThreadPool.setIdleTimeout(int)

SessionHandler不再具有getSessionManager()方法.

SessionHandler no longer has a getSessionManager() method.

在过去的6个主要版本更新中,会话处理比连接器进行了更大的更改.

The Session Handling has undergone even greater change over the past 6 major version updates then the connectors.

请参阅:

queueThreadPool也不再具有setMaxQueued(int),而JettyServer不再具有这两种方法:setThreadPool(QueueThreadPool)setGracefulShutdown(int)

Also the queueThreadPool no longer has a setMaxQueued(int ), and JettyServer no longer has these two methods: setThreadPool(QueueThreadPool) setGracefulShutdown(int)

QueuedThreadPool 是构造函数的一部分.最小/最大没有设置器.

The configuration for min/max in QueuedThreadPool are part of the Constructors. There are no setters for min/max.

要配置 Server 线程池,请使用允许您传入线程池的构造函数.

To configure the Server thread pool, use the constructors that allow you to pass in a Thread Pool.

注意:如果您使用的是HTTP/2,并且使用html/css/javascript,我们建议您计划增加线程池需求(由于协议的性质)

这篇关于将Jetty 8升级到Jetty 9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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