Does Dropwizard support a servlet of 3 asynchronous servlets?

Does Dropwizard support asynchronous Servlet 3 servlets? If not, is it on the roadmap anytime in the near future?

+4
source share
2 answers

It uses Jetty 8, which supports Servlet 3.0. Jersey (and JAX-RS) has no support for this, but it is expected in JAX-RS 2.0 (and Jersey 2.0). Dropwizard does not add anything special, but when Jersey 2.0 is released, the next major release of Dropwizard is likely to include it.

+9
source

You can use https://github.com/jetty-project/jetty-eventsource-servlet . Read the wiki on how to use Servlet and EventSource

In your DW Service implementation, you add your SSE servlet

environment.addServlet(new MySseEventSourceServlet(), "/sse"); 

Then add this to your DW configuration

 http: connectorType: NONBLOCKING 

Now you can start listening to the event sent by the server on

 <host>:<port>/sse 

ex.

 curl localhost:8080/sse -H"Accept: text/event-stream" 

See @GitHub working example, https://github.com/andershedstrom/dropwizard-with-sse

+3
source

All Articles