Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
/ underwrap Public archive

A very thin wrapper of Undertow and Resteasy

Notifications You must be signed in to change notification settings

treasure-data/underwrap

Repository files navigation

Underwrap

A very thin wrapper of Undertow and Resteasy

Usage

Maven

pom.xml

<dependencies>
    <dependency>
        <groupId>com.treasuredata</groupId>
        <artifactId>underwrap</artifactId>
        <version>0.1.4</version>
    </dependency>
</dependencies>

Gradle

build.gradle

dependencies {
    compile 'com.treasuredata:underwrap:0.1.4'
}

Example

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class UnderwrapExample
{
    public static void main(String[] args)
    {
        UnderwrapServer server = new UnderwrapServer(MyApplication.class);
        Map<Class, Object> contextMqp =  new HashMap<>();
        contextMqp.put(String.class, "This is UnderwrapExample");
        server.start(contextMqp, null,
                serverBuild -> {
                    serverBuild.addHttpListener(8080, "0.0.0.0");
                }
        );
    }

    public static class MyApplication
        extends UnderwrapServer.UnderwrapApplication
    {
        @Override
        protected void registerResources(Set<Class<?>> classes)
        {
            classes.add(Resources.class);
        }
    }

    @Path("/")
    public static class Resources
    {
        private final String comment;

        public Resources(@Context String comment)
        {
            this.comment = comment;
        }

        @GET
        @Path("/hello")
        public String hello()
        {
            return "Hello! " + comment;
        }
    }
}

About

A very thin wrapper of Undertow and Resteasy

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages