Jetty 8, servlet 3.0 and continuations

2019-05-15 13:22发布

问题:

Is the continuation features of Jetty not needed with servlet 3.0 asychronous I/O?

Is there a difference or how should I as a developer see things? Can someone elaborate on this topic?

回答1:

If you know that you are always deploying to a Servlet 3.0 compliant container, and you are comfortable with the asynchronous servlet API, then there's no need for Jetty continuations.

The two things continuations give you are:

  • They have an (arguably) simpler API.
  • They are (somewhat) portable to servlet 2.x containers.

To be clear on this last point, the continuation API is portable between containers, but it has the following behaviour:

  • On Jetty 6, 7 or 8 it will use Jetty's native asynchronous functionality
  • On servlet 3.0 containers it will use the asynchronous servlet API
  • On other (2.x) containers it will behave synchronously.

Some more info (but getting a little dated) is available here



回答2:

The continuation filter was kind of a hot fix in order to overcome the issue of the servlet API (which basically is thread per request) and server push functionalities. The async Feature defined in servlet API 3.0 replaces this Filter and allows asynchrounous processing of a request based in configuration in your Web.xml.



标签: Jetty