Wednesday, February 26, 2014

Announcing Hammock

I'd like to introduce the world to Hammock

Hammock is based on my last blog post, creating a light weight service to run JAX-RS resources over a minimalistic configuration.

Binaries are currently up on Sonatype OSS (I hope they sync to MVN central shortly):;quick~ws.ament.hammock


What is Hammock?

Hammock is a light weight integration between JBoss RestEasy, Undertow and Weld.  Leveraging Weld SE, it provides automatic resource scanning and minimal binding code to launch a web container (Undertow) running the basic services to launch a full JAX-RS application.

Getting Started

Getting started with Hammock is simple.  Add a reference to the project in your pom.xml:


Add your REST Resource class:

public class EchoResource {
    public String greet() {
        return "hello";

Implement the configuration, for application (via @ApplicationConfig)

public class ApplicationConfigBean implements WebServerConfiguration {
    public int getPort() {
        return 8080;
    public String getContextRoot() {
        return "/api";
    public Collection getProviderClasses() {
        return Collections.EMPTY_LIST;
    public Collection getResourceClasses() {
        return Collections.singleton(EchoResource.class);
    public String getBindAddress() {
        return "";

You can optionally also do this for a management interface as well (via @ManagementConfig).  The resources tied to each of these configurations would then be launched when you start your application.

Starting your app can be done manually via Weld SE, or by using their built in class, .