Cover by Bill Burke

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

JBoss RESTEasy

JBoss RESTEasy is Red Hat’s implementation of JAX-RS and is the project I lead and run at Red Hat. It is licensed under the GNU Lesser General Public License (LGPL) and can be used in any environment that has a servlet container. Many of its features overlap with other JAX-RS implementations, so I’ll highlight only distinguishing features here.

Embedded Container

An important part of software development is unit testing. Personally, I prefer to work with as many of the real subsystems as possible when writing unit tests instead of mocking them up. Mocks can be useful, but many times your code behavior is different when you run it within your deployment environment. When I created RESTEasy, I wanted it to be embeddable within unit tests so that developers could make over-the-wire invocations to their JAX-RS resources without having to install, build, and run an entire servlet container. Given that, speed is such an important factor when running unit tests because of how often you run them during your development cycle. With this in mind, I wanted to pick an embeddable servlet container that had the best boot-time performance. After some research I picked TJWS,[26] a tiny, relatively unknown, embeddable servlet container.

Using the embeddable container is really easy. Here’s an example:

import javax.ws.rs.GET; import javax.ws.rs.Path; import org.jboss.resteasy.plugins.server.tjws.TJWSEmbeddedJaxrsServer; import org.jboss.resteasy.spi.ResteasyDeployment; import org.jboss.resteasy.client.ClientRequest; ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required