Introducing Espresso, a core web abstraction for Java – The future of Java web ecosystem?

Share
  • November 19, 2018

One of the things that never bore us is covering new and interesting Java tools! Today, we have a core web abstraction for Java, called Espresso that aspires to become the soul of modern Java web application!

As Java has been experiencing a more intense cycle of innovation with the new release cadence, it’s not unusual to see the development of the Java ecosystem as well as the language itself move a lot faster lately.

    DevOpsCon Whitepaper 2018

    Free: BRAND NEW DevOps Whitepaper 2018

    Learn about Containers,Continuous Delivery, DevOps Culture, Cloud Platforms & Security with articles by experts like Michiel Rook, Christoph Engelbert, Scott Sanders and many more.

However, there’s still a part of the Java ecosystem that is arguably underdeveloped and that is web Java. As Ning Sun, the creator of Espresso argued, the Servlet API is outdated, heavy, and verbose and even though Spring Boot has improved Java development, a simpler abstraction like Python’s WSGI would still be the preferred choice.

SEE ALSO: Testcontainers is a lightweight Java library for anything that can run in a Docker container

And that was the main motivation behind the creation of Espresso!

Espresso is heavily inspired by Clojure’s Ring and Rust’s Iron and it is accompanied by three micro-libraries that support it, namely:

  • Jettino: An espresso adapter for Jetty
  • Latte: URL router for Espresso
  • Sugar: parameter extractor

The key concepts of the espresso ecosystem include:

  • App: Espresso function implementation.
  • Server: A container to run espresso function.
  • Adapter: A adapter layer for existed Java web server to run espresso function.
  • Plugin or Middleware: An espresso function wrapper that provides additional features or data to core espresso function.

This is how a ‘hello world’ web application with espresso can look like:

import io.github.espresso4j.espresso.*;
import io.github.espresso4j.jettino.Jettino;

public class App {

    public static void main(String[] args) throws Exception {
        new Jettino().start((req) -> Response.of(200).body("It works."));
    }

}

Getting started

You can find a simple demo here that you can run with gradle run.

You can also find the libraries published on Maven central.

The post Introducing Espresso, a core web abstraction for Java – The future of Java web ecosystem? appeared first on JAXenter.

Source : JAXenter