简体   繁体   English

将Jetty 8升级到Jetty 9

[英]Upgrading Jetty 8 to Jetty 9

I am upgrading from jetty 8 to jetty 9 and have come across some issues around compilation failures within some APIs. 我正在从jetty 8升级到jetty 9,并且遇到了一些API中的编译失败问题。

The SslSelectChannelConnector has been removed and from what I can see httpConfiguration with secureRequestCustomizer replaces this. SslSelectChannelConnector已被删除,我可以看到httpConfiguration with secureRequestCustomizer取代了它。

But there are many methods that I cant find on both. 但是我找不到两种方法。 For example 例如

setRequestBufferSize setRequestBufferSize

setResponseBufferSize setResponseBufferSize

setAcceptors setAcceptors

setMaxIdleTime setMaxIdleTime

SessionHandler no longer has a getSessionManager() method. SessionHandler不再具有getSessionManager()方法。

Also the queueThreadPool no longer has a setMaxQueued(int ), and JettyServer no longer has these two methods: setThreadPool(QueueThreadPool) setGracefulShutdown(int) 此外,queueThreadPool不再具有setMaxQueued(int),并且JettyServer不再具有以下两种方法:setThreadPool(QueueThreadPool)setGracefulShutdown(int)

Edit: SslSelectChannelConnector Deprecated. 编辑:SslSelectChannelConnector已弃用。 use SelectChannelConnector with SslContextFactory. 将SelectChannelConnector与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);

Where or which API is used in place of the above? 使用何处或使用哪种API代替上述?

Also is there any custom stuff that stopped working at runtime, that isn't obvious to find/see. 还有任何自定义的东西在运行时停止工作,这是不明显的查找/看到。

Reminder: Jetty versioning (since 1995) is <servlet_support>.<major_version>.<minor_version> 提醒:Jetty版本控制(自1995年起)是<servlet_support>.<major_version>.<minor_version>

You are doing a major version upgrade from 8.1 to 9.4 (which is 6 major versions!). 您正在进行从8.1到9.4的主要版本升级(这是6个主要版本!)。 You are seeing a massive amount of change as a result of this. 由于这个原因,你看到了大量的变化。

The SslSelectChannelConnector has been removed and from what I can see httpConfiguration with secureRequestCustomizer replaces this. SslSelectChannelConnector已被删除,我可以看到httpConfiguration with secureRequestCustomizer取代了它。

Welcome to the new world of protocols. 欢迎来到协议的新世界。

There is no longer any concept of protocol specific connectors. 不再有任何协议特定连接器的概念。

ServerConnector is the connector, it has no protocol knowledge, nor needs it. ServerConnector是连接器,它没有协议知识,也不需要它。 It simply is a connection point (not even TCP/IP specific, it could be Unix Sockets for example) to the server. 它只是服务器的连接点(甚至不是特定于TCP / IP,可能是Unix套接字)。

The configuration of it, determines the connection type, where it binds, and how the protocol is negotiated once the client connects to that port. 它的配置,确定连接类型,绑定位置以及客户端连接到该端口后如何协商协议。

The ConnectionFactory determines that. ConnectionFactory确定了这一点。

The HttpConfiguration determines how the HTTP level behavior functions. HttpConfiguration确定HTTP级别行为的功能。

See: https://stackoverflow.com/a/30191878/775715 for description. 有关说明,请参阅: https//stackoverflow.com/a/30191878/775715

See: embedded-jetty examples of this is use. 请参阅: embedded-jetty这个例子就是使用。 Start with LikeJettyXml.java . LikeJettyXml.java开始。

See: embedded-jetty-cookbook for more examples. 有关更多示例,请参阅: embedded-jetty-cookbook

But there are many methods that I cant find on both. 但是我找不到两种方法。 For example 例如

setRequestBufferSize setRequestBufferSize

This doesn't exist anymore, it was incompatible with SPDY and HTTP/2 这不再存在,它与SPDY和HTTP / 2不兼容

See HttpConfiguration.setRequestHeaderSize(int) for controlling the maximum request header size. 请参阅HttpConfiguration.setRequestHeaderSize(int)以控制最大请求标头大小。

Note: If you are using HTTP/2, we would recommend that you do not adjust the request header size to be bigger then default (for protocol compatibility reasons). 注意:如果您使用的是HTTP / 2,我们建议您不要将请求标头大小调整为大于默认值(出于协议兼容性原因)。

setResponseBufferSize setResponseBufferSize

This doesn't exist anymore, it was incompatible with SPDY and HTTP/2. 这不再存在,它与SPDY和HTTP / 2不兼容。

See HttpConfiguration.setResponseHeaderSize(int) for controlling the maximum response header size. 请参阅HttpConfiguration.setResponseHeaderSize(int)以控制最大响应标头大小。

Note: If you are using HTTP/2, we would recommend that you do not adjust the response header size to be bigger then default (for protocol compatibility reasons). 注意:如果您使用的是HTTP / 2,我们建议您不要将响应标头大小调整为大于默认值(出于协议兼容性原因)。

See HttpConfiguration.setOutputBufferSize(int) for output buffer aggregation controls. 有关输出缓冲区聚合控件,请参阅HttpConfiguration.setOutputBufferSize(int) (has little meaning in HTTP/2, is really only relevant for HTTP/1.x) (在HTTP / 2中没有什么意义,实际上只与HTTP / 1.x相关)

setAcceptors setAcceptors

See the various constructors for ServerConnector , there are no setters for these. 请参阅ServerConnector的各种构造函数,这些构造函数没有。

setMaxIdleTime setMaxIdleTime

There are many idle timeout settings available to you (eg: connector, connection, endpoint, thread, threadpool, AsyncContext, read, write, websocket session, etc ...) 您可以使用许多空闲超时设置(例如:连接器,连接,端点,线程,线程池,AsyncContext,读取,写入,websocket会话等...)

Here's a few examples that seem relevant based on your questions. 以下是一些基于您的问题看似相关的示例。

See ServerConnector.setIdleTimeout(long) 请参见ServerConnector.setIdleTimeout(long)

See HttpConfiguration.setIdleTimeout(long) 请参阅HttpConfiguration.setIdleTimeout(long)

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

SessionHandler no longer has a getSessionManager() method. SessionHandler不再具有getSessionManager()方法。

The Session Handling has undergone even greater change over the past 6 major version updates then the connectors. 会话处理在过去的6个主要版本更新和连接器上经历了更大的变化。

See: OneServletContextWithSession.java 请参阅: OneServletContextWithSession.java

Also the queueThreadPool no longer has a setMaxQueued(int ), and JettyServer no longer has these two methods: setThreadPool(QueueThreadPool) setGracefulShutdown(int) 此外,queueThreadPool不再具有setMaxQueued(int),并且JettyServer不再具有以下两种方法:setThreadPool(QueueThreadPool)setGracefulShutdown(int)

The configuration for min/max in QueuedThreadPool are part of the Constructors. QueuedThreadPool中min / max的配置是QueuedThreadPool的一部分。 There are no setters for min/max. 最小/最大没有设定者。

To configure the Server thread pool, use the constructors that allow you to pass in a Thread Pool. 要配置Server线程池,请使用允许您传入线程池的构造函数。

Note: If you are using HTTP/2, with html/css/javascript we would recommend that you plan for increased thread pool demand (due to the nature of the protocol) 注意:如果您使用HTTP / 2,使用html / css / javascript,我们建议您计划增加线程池需求(由于协议的性质)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM