Jooby framework simplifies Java Web development

19.01.2016
When it comes to Web development, Ruby has the Sinatra framework and Node.js has Express.js. Now, Java has micro Web framework Jooby.

Built by developer Edgar Espina, Jooby offers modular, stateless application development leveraging NIO (non-blocking IO) servers including Netty, Jetty, or Undertow.

The main intent of Jooby is simplicity, according to Espina. "Although Java is a simple and easy-to-learn programming language, building Web applications in Java has always been a challenge," he said in an email. "The Java community has done a lot to simplify the development of Web applications.... Still the effort to build a Web application in Java is high compared to Ruby or Node. Jooby comes to fill that gap and simplify Web development in Java by providing an unopinionated, simple, and easy-to-learn micro Web framework."

At the core of Jooby are modules, which are built to expose functionality from an external library. "They are thin and do a lot of work to bootstrap and configure the external library, but they don't provide a new level of abstraction nor [do] they provide a custom API to access functionality in that library. Instead they expose the library components as they are," Espina said. "This is a major difference with other Java Web frameworks."

Jooby provides defaults for typical aspects of applications, such as database access, authentication, sessions, template engine, and email. This makes it easy to get started using it, Espina said, "but at the same time it is incredibly flexible and modular, and more experienced users can mix and match modules as needed and even write their own integrations."

Stateless application development in Jooby enables it to scale without major effort, especially if developers build REST APIs with header/JWT (JSON Web Token) authentication. There are some use cases, however, where developers need to save user information. "For such use cases, you can use the HTTP Session," said Espina.

Jooby features an in-memory HTTP session, but developers can choose different back ends, such as Redis and HazelCast and MongoDB. The HTTP session was designed to be small and force developers to think twice about what to use, as the only data allowed are primitives and strings.

The framework has two programming models. One is a script programming model, in which developers define and write an application into a single file. For large and complex applications, Jooby supports MVC. "Here, you probably split your application into layers and create one or more controller classes," Espina said.

Jooby has been around for about 18 months, and a formal 1.0.0 release is planned for early this year. Targeted for Java 8 or higher, Jooby also will work with Project Nashorn, thus extending Jooby to JavaScript. "It is a Java framework, as it is always running on the JVM, but it can also be thought of a JavaScript framework from the developer perspective," said Espina, who plans to add support for other JVM languages.

(www.infoworld.com)

Paul Krill

Zur Startseite