Built-in NIO http client / server in Java

I am developing an application that communicates with other applications with REST services, i.e. provides REST services on its own and consumes other REST services. In other words, the application runs both an HTTP server and a client.

I am currently using the Jetty Embedded Web Server and Apache HttpClient . Now I'm wondering if it would be easier to use a single single-threaded component that processes all incoming / outgoing HTTP requests / responses in non-blocking mode using Java NIO ?

Does it make sense? Do you know about an open source library that does this?

+4
source share
2 answers
  • Simple is a project whose goal is to provide a truly embedded Java-based Java engine that can handle huge loads. It works, it is easy to integrate and can handle enough load.
  • IceBreak REST is very, very small and very capable.
  • Restlet - it has an internal connector, but I'm not sure if it can accept many requests.
  • I have no idea how the application was developed, but if you used Jersey, there are several ways to start the server, for example, the Grizzly container, a simple Jersey server, and a lightweight HTTP server. All in docs
+2
source

You might want to use the Jetty Client instead of the Apache HttpClient if you want to have a Jetty-only solution.

Other alternatives may be

+2
source

Source: https://habr.com/ru/post/1398297/


All Articles