嵌入式Jetty 9 HttpException等效?

时间:2016-08-31 13:55:25

标签: eclipse embedded-jetty httpexception

我们正在从Jetty 6升级到Jetty 9,但是在我们之前的代码中我们抛出的是org.eclipse.jetty.http.HttpException,但我看到这个类在9.x中删除了。是否有这个类的等价物,或者我应该定义一个具有相同内容的新类,以便在我的代码中使用它?

1 个答案:

答案 0 :(得分:0)

Jetty 7.6 was the first version to not have HttpException.

It was removed as part of commit d81f9c1e

The purpose of HttpException was limited to reporting really bad HTTP parsing issues with bad requests (all of which would result in a 400 Bad Request). That implementation was changed to use HttpParser.badMessage() instead, as that will properly set the connection state, and then allow implementations of HttpHandler.badMessage() to log or produce whatever response is desired, afterwords resulting in a forced connection close.

Without this change, it was not possible to log 400 Bad Request in the access log, and customize the error 400 response message.

There is no equivalent exception for HttpException present in Jetty 7.6+.

It was an internal class anyway, not meant for you to be using.

What are you attempting to accomplish by using that?

相关问题