You are previewing RESTful Java with JAX-RS.

RESTful Java with JAX-RS

Cover of RESTful Java with JAX-RS by Bill Burke Published by O'Reilly Media, Inc.

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; import; import org.jboss.resteasy.plugins.server.tjws.TJWSEmbeddedJaxrsServer; import org.jboss.resteasy.spi.ResteasyDeployment; import org.jboss.resteasy.client.ClientRequest; ...

The best content for your career. Discover unlimited learning on demand for around $1/day.