https://github.com/treasure-data/underwrap
A very thin wrapper of Undertow and Resteasy
https://github.com/treasure-data/underwrap
resteasy undertow
Last synced: 5 months ago
JSON representation
A very thin wrapper of Undertow and Resteasy
- Host: GitHub
- URL: https://github.com/treasure-data/underwrap
- Owner: treasure-data
- Archived: true
- Created: 2017-05-17T08:22:41.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-03-22T03:34:07.000Z (about 5 years ago)
- Last Synced: 2024-04-10T19:38:20.476Z (about 2 years ago)
- Topics: resteasy, undertow
- Language: Java
- Homepage:
- Size: 88.9 KB
- Stars: 2
- Watchers: 79
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Underwrap
[
](https://travis-ci.org/treasure-data/underwrap)
A very thin wrapper of Undertow and Resteasy
## Usage
### Maven
#### pom.xml
```xml
com.treasuredata
underwrap
0.1.4
```
### Gradle
#### build.gradle
```groovy
dependencies {
compile 'com.treasuredata:underwrap:0.1.4'
}
```
## Example
```java
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 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> 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;
}
}
}
```