Skip to main content

Overview

Powerful asynchronous HTTP server and client with WebSocket support.

Concise and more efficient alternative to Spring, Jetty, Vert.x, and other similar solutions. ActiveJ HTTP significantly outperforms them, which is proven by numerous benchmarks.

Provides tools for building HTTP servers and clients with asynchronous I/O in a simple and convenient way:

public final class HttpHelloWorldExample extends HttpServerLauncher {  @Provides  AsyncServlet servlet() {    return request -> HttpResponse.ok200().withPlainText("Hello World");  }
  public static void main(String[] args) throws Exception {    Launcher launcher = new HttpHelloWorldExample();    launcher.launch(args);  }}

Features#

  • Fully asynchronous
  • No third-party dependencies, built on top of ActiveJ Net module
  • No legacy layers of adapters
  • WebSocket support
  • TLS support
  • Can be used as an application web server: supports externally provided ActiveJ Inject (DI) modules with business logic and AsyncServlets
  • Extremely fast as proven by benchmarks
  • Highly optimized and GC-friendly:
    • Automatic recycling of ByteBufs associated with HttpRequest/HttpResponse and also ByteBufs received from Net async sockets
    • Optimized headers multimap and internal URL representation with low yield of garbage objects
    • Specialized headers subclasses render their content directly into ByteBuf, without intermediate garbage objects

AsyncServlet#

  • Basically, it's just an async function, mapping HttpRequest to HttpResponse
  • Collection of pre-defined AsyncServlets out of the box (StaticServlet, BlockingServlet, RoutingServlet, etc.)
  • Extensive support of functional composition of AsyncServlets. RoutingServlet for building servlet routing
    • Flexible mapping of HTTP paths and methods to AsyncServlets (including other RoutingServlets)
    • Support of path parameters (like /users/:id) and relative paths

Add ActiveJ HTTP to your project#

You can add ActiveJ HTTP to your project by importing its Maven repository. These docs cover the most recent release of ActiveJ HTTP v5.0-beta2 (see on Github or Maven).