简体   繁体   English

码头升级8至9失踪舱位

[英]jetty upgrade 8 to 9 missing classes

I previously asked this question -> Upgrading Jetty 8 to Jetty 9 which helped for a particular upgrade with some of the missing packages/classes. 我之前曾问过这个问题-> 将Jetty 8升级到Jetty 9 ,这有助于对某些缺少的软件包/类进行特定的升级。

I have a slightly older version being upgraded now, and it has packages and classes that are no longer in Jetty, and I cant find any documentation to see what or where/if they have been replaced. 我有一个稍旧的版本现在正在升级,并且它的软件包和类在Jetty中不再存在,并且我找不到任何文档来查看替换的内容或位置。

The following no longer exist: 以下不再存在:

import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.util.thread.Timeout;
import org.eclipse.jetty.server.AbstractHttpConnection;

The HttpURI.getCompletePath no longer exists can I use getPath() or getDecodedPath() HttpClient no longer has: HttpURI.getCompletePath不再存在,我可以不再使用HttpClient的getPath()或getDecodedPath()吗:

setThreadPool 
setMaxConnectionsPerAddress 
setTimeout 
setRequestHeaderSize 
setResponseHeaderSize

I can use QueuedThreadPool on HttpConfiguration, and most of the above methods are also on HTTPConfiguration, but is setTimeout(httpClient), now setIdleTimeout(HttpConfiguration)? 我可以在HttpConfiguration上使用QueuedThreadPool,并且上述大多数方法也在HTTPConfiguration上,但是setTimeout(httpClient)是setIdleTimeout(HttpConfiguration)吗?

HttpExchange() no longer has a public default constructor and therefore I cant override it with a default constructor. HttpExchange()不再具有公共的默认构造函数,因此我无法使用默认构造函数覆盖它。 In the new HttpExchange(9.4) it requires the following three arguments in construtctor: 在新的HttpExchange(9.4)中,它在构造函数中需要以下三个参数:

 HttpDestination destination, HttpRequest request, List<Response.ResponseListener> listeners 

What class are they on now? 他们现在在上什么课? I only have access to the HttpClient _client, ServletConfig and ServletContext 我只能访问HttpClient _client,ServletConfig和ServletContext

The following methods no longer exist either: 以下方法也不再存在:

onResponseContent
onResponseHeaderComplete
onResponseStatus
onResponseHeader
onConnectionFailed
setRequestHeader
exchange.setScheme(HttpScheme.HTTPS.equals(request.getScheme())?HttpScheme.HTTPS_BUFFER:HttpScheme.HTTP_BUFFER);
exchange.setMethod(request.getMethod());
exchange.setURL(url.toString());
exchange.setVersion(request.getProtocol());
addRequestHeader

Is there a replacement for HttpExchange or another class with these methods? 是否可以用这些方法替代HttpExchange或其他类?

IO.copyThread(InputStream, OutputStream) no longer exists IO.copyThread(InputStream,OutputStream)不再存在

org.eclipse.jetty.server.RequestRequest no longer has getConnection(); org.eclipse.jetty.server.RequestRequest不再具有getConnection();

import org.eclipse.jetty.io.Buffer; 导入org.eclipse.jetty.io.Buffer;

Does not exist, we use java.nio.ByteBuffer now. 不存在,我们现在使用java.nio.ByteBuffer

import org.eclipse.jetty.util.thread.Timeout; 导入org.eclipse.jetty.util.thread.Timeout;

No replacement, idle timeout is handled in-line with the various places that need it. 没有替换,空闲超时将与需要它的各个地方一起在线处理。

import org.eclipse.jetty.server.AbstractHttpConnection; 导入org.eclipse.jetty.server.AbstractHttpConnection;

No replacement, the entire Connector layer has been completely rewritten about 6 years ago. 无需更换,整个连接器层大约在6年前已被完全重写。

HttpURI.getCompletePath no longer exists can I use getPath() or getDecodedPath() HttpURI.getCompletePath不再存在,我可以使用getPath()或getDecodedPath()

Use java.net.URI . 使用java.net.URI

The HttpURI of Jetty 9 has no relationship with what you used in Jetty 8. Jetty 9的HttpURI与您在Jetty 8中使用的无关。

We use java.net.URI internally for many things, and only use HttpURI to piece together a URI for purposes of HTTP/2 physical connection vs logical channel request. 我们在内部将java.net.URI用于许多事情,并且仅出于HTTP / 2物理连接与逻辑通道请求的目的,仅使用HttpURI将URI拼凑在一起。

HttpClient no longer has: HttpClient不再具有:

HttpClient was rewritten about 6 years ago to satisfy the updated HTTP/1.1 RFCs, and HTTP/2, and FastCGI, and Proxy usages. HttpClient在大约6年前进行了重写,以满足更新的HTTP / 1.1 RFC,HTTP / 2,FastCGI和代理用法。

From the types of questions you are asking, you might want to look into the entire extensible proxy layer that Jetty has built-in 根据您所询问的问题类型,您可能需要研究Jetty内置的整个可扩展代理层。

setThreadPool setThreadPool

Use setExecutor() 使用setExecutor()

Note: this is not a wise thing to mess around with, especially with the huge differences in connection processing between Jetty 8 and Jetty 9. 注意:这不是一件明智的事情,特别是在Jetty 8和Jetty 9之间的连接处理方面存在巨大差异的情况下。

A single request can be handled (during its lifetime) from [1..n] threads. 可以从[1..n]线程处理单个请求(在其生命周期内)。

The most common reason stated for messing with the executor (threadpool) is to artificially limit resource utilization. 与执行器(线程池)发生冲突的最常见原因是人为地限制资源利用。 Messing with the executor is the wrong place to limit resource utilization. 与执行器混淆是限制资源利用率的错误位置。

setMaxConnectionsPerAddress setMaxConnectionsPerAddress

Connections are now pooled. 连接已合并。

You can choose your connection pool implementation, and also set a few generic connection pool behaviors on the HttpClient . 您可以选择连接池实现,还可以在HttpClient上设置一些通用的连接池行为。

See setMaxConnectionsPerDestination​ and setMaxRequestsQueuedPerDestination​ setMaxConnectionsPerDestination​setMaxRequestsQueuedPerDestination​

setTimeout setTimeout

There are many timeouts now. 现在有很多超时。

  • HttpClient.setIdleTimeout HttpClient.setIdleTimeout
  • HttpClient.setConnectTimeout HttpClient.setConnectTimeout
  • Request.setIdleTimeout Request.setIdleTimeout
  • Connection idle timeout 连接空闲超时
  • Connection pool idle timeout 连接池空闲超时

setRequestHeaderSize setResponseHeaderSize setRequestHeaderSize setResponseHeaderSize

Does not exist for jetty-client, these are server side concepts. Jetty客户端不存在,这些是服务器端的概念。

I can use QueuedThreadPool on HttpConfiguration, and most of the above methods are also on HTTPConfiguration, but is setTimeout(httpClient), now setIdleTimeout(HttpConfiguration)? 我可以在HttpConfiguration上使用QueuedThreadPool,并且上述大多数方法也在HTTPConfiguration上,但是setTimeout(httpClient)是setIdleTimeout(HttpConfiguration)吗?

HttpClient and HttpConfiguration are unrelated. HttpClient和HttpConfiguration无关。

HttpExchange() no longer has a public default constructor and therefore I cant override it with a default constructor. HttpExchange()不再具有公共的默认构造函数,因此我无法使用默认构造函数覆盖它。 In the new HttpExchange(9.4) it requires the following three arguments in construtctor: What class are they on now? 在新的HttpExchange(9.4)中,它在构造器中需要以下三个参数:它们现在在什么类上? I only have access to the HttpClient _client, ServletConfig and ServletContext 我只能访问HttpClient _client,ServletConfig和ServletContext

The following methods no longer exist either: 以下方法也不再存在:

onResponseContent onResponseHeaderComplete onResponseStatus onResponseHeader onConnectionFailed setRequestHeader exchange.setScheme(HttpScheme.HTTPS.equals(request.getScheme())?HttpScheme.HTTPS_BUFFER:HttpScheme.HTTP_BUFFER); onResponseContent onResponseHeaderComplete onResponseStatus onResponseHeader onConnectionFailed setRequestHeader exchange.setScheme(HttpScheme.HTTPS.equals(request.getScheme())?HttpScheme.HTTPS_BUFFER:HttpScheme.HTTP_BUFFER); exchange.setMethod(request.getMethod()); exchange.setMethod(request.getMethod()); exchange.setURL(url.toString()); exchange.setURL(url.toString()); exchange.setVersion(request.getProtocol()); exchange.setVersion(request.getProtocol()); addRequestHeader Is there a replacement for HttpExchange or another class with these methods? addRequestHeader是否可以使用这些方法替代HttpExchange或其他类?

HttpExchange is an internal class and is not meant for you to use/access/configure or generally mess with. HttpExchange是一个内部类,并不意味着您可以使用/访问/配置它或将其弄乱。

I suspect you are looking at an ancient codebase that had an HttpExchange concept for the jetty-client. 我怀疑您正在查看的是古老的代码库,该代码库为码头用户提供了HttpExchange概念。

That entire concept does not exist for HttpClient anymore in Jetty 9. 在Jetty 9中,HttpClient不再存在整个概念。

You create a org.eclipse.jetty.client.api.Request (see the various HttpClient.newRequest() methods), hook into various listeners on the request, and Request.send() it. 您创建一个org.eclipse.jetty.client.api.Request (请参阅各种HttpClient.newRequest()方法),挂接到请求的各种侦听器中,然后对它进行Request.send() Responding to the various listener events that you are interested in. 响应您感兴趣的各种侦听器事件。

I would suggest you start with Response.CompleteListener only at first, looking closely at the Result object passed to you in its onComplete(Result) method. 我建议您首先只从Response.CompleteListener开始,仔细查看通过onComplete(Result)方法传递给您的Result对象。

IO.copyThread(InputStream, OutputStream) no longer exists IO.copyThread(InputStream,OutputStream)不再存在

No longer exists, no replacement (it was the source of many bugs/issues) 不再存在,没有替代(这是许多错误/问题的根源)

org.eclipse.jetty.server.RequestRequest no longer has getConnection(); org.eclipse.jetty.server.RequestRequest不再具有getConnection();

DANGER WILL ROBINSON - this indicates a seriously bad/dangerous codebase. DANGER WILL ROBINSON-表示代码库严重/危险。 The codebase that does that should never have existed in the first place. 这样做的代码库最初不应该存在。

While there are internal ways to access the connection/endpoint/channel/httpinput/httpoutput/interceptors, all of those concepts have to be taken into account for any hope of success, not just the connection. 尽管有内部访问连接/端点/通道/ httpinput / httpoutput / interceptor的方法,但要想获得成功的希望,就必须考虑所有这些概念,而不仅仅是连接。

Your questions are screaming "I have an old proxy i'm attempting to update". 您的问题尖叫“我有一个旧的代理,我正在尝试更新”。 Jetty is now 100% Async, the older InputStream/OutputStream behaviors from Servlet 2.x days are long gone. 现在,Jetty是100%异步的,从Servlet 2.x开始,较早的InputStream / OutputStream行为已不复存在。 If you don't develop a proxy solution with Async I/O in mind you are doomed to endless errors/issues/failures until you update it for Servlet 3.1 Async I/O features. 如果您不考虑使用异步I / O开发代理解决方案,那么注定会出现无尽的错误/问题/失败,直到为Servlet 3.1异步I / O功能更新它为止。

Do yourself a favor and read up on entire org.eclipse.jetty.proxy package. 帮个忙,阅读整个org.eclipse.jetty.proxy软件包。

You'll wind up either extending AsyncProxyServlet (for typical proxy behaviors) or AsyncMiddleManServlet (for proxy with content modification behaviors), with the servlet side Async I/O implementation hooked into the Async I/O behaviors of the HttpClient intelligently. 您将扩展AsyncProxyServlet (用于典型的代理行为)或AsyncMiddleManServlet (用于具有内容修改行为的代理),并将Servlet端Async I / O实现智能地链接到HttpClient的Async I / O行为。

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

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