webbit-rest

An uri-template based REST API for Webbit

License

License

GroupId

GroupId

org.webbitserver
ArtifactId

ArtifactId

webbit-rest
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

webbit-rest
An uri-template based REST API for Webbit
Project URL

Project URL

http://webbitserver.org/

Download webbit-rest

How to add to project

<!-- https://jarcasting.com/artifacts/org.webbitserver/webbit-rest/ -->
<dependency>
    <groupId>org.webbitserver</groupId>
    <artifactId>webbit-rest</artifactId>
    <version>0.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webbitserver/webbit-rest/
implementation 'org.webbitserver:webbit-rest:0.3.0'
// https://jarcasting.com/artifacts/org.webbitserver/webbit-rest/
implementation ("org.webbitserver:webbit-rest:0.3.0")
'org.webbitserver:webbit-rest:jar:0.3.0'
<dependency org="org.webbitserver" name="webbit-rest" rev="0.3.0">
  <artifact name="webbit-rest" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webbitserver', module='webbit-rest', version='0.3.0')
)
libraryDependencies += "org.webbitserver" % "webbit-rest" % "0.3.0"
[org.webbitserver/webbit-rest "0.3.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webbitserver : webbit jar 0.4.12

provided (1)

Group / Artifact Type Version
com.samskivert : jmustache jar 1.5

test (1)

Group / Artifact Type Version
junit : junit jar 4.10

system (1)

Group / Artifact Type Version
org.weborganic » furi jar 0.8.4

Project Modules

There are no modules declared in this project.

Webbit-REST

Webbit-REST is a small Sinatra-inspired API for the Webbit web server. It is based on RFC 6570 and the excellent wo-furi library.

Sample usage:

WebServer webServer = new NettyWebServer(9991);
Rest rest = new Rest(webServer);
rest.GET("/people/{name}/pets/{petName}", new HttpHandler() {
    @Override
    public void handleHttpRequest(HttpRequest req, HttpResponse res, HttpControl ctl) {
        String name = Rest.param(req, "name");
        String petName = Rest.param(req, "petName");
        res.content(String.format("Name: %s\nPet: %s\n", name, petName)).end();
    }
});
webServer.start().get();
System.out.println("Try this: curl -i localhost:9991/people/Mickey/pets/Pluto");

Redirecting:

rest.GET("/people/{name}/animals/{petName}", new HttpHandler() {
    @Override
    public void handleHttpRequest(HttpRequest req, HttpResponse res, HttpControl ctl) {
        Rest.redirect(res, "/people/{name}/pets/{petName}",
                "name", param(req, "name"),
                "petName", param(req, "petName")
        );
    }
});

Installation

Maven

<dependency>
    <groupId>org.webbitserver</groupId>
    <artifactId>webbit-rest</artifactId>
    <version>0.2.0</version>
</dependency>

Not Maven

https://oss.sonatype.org/content/repositories/releases/org/webbitserver/webbit-rest/0.2.0/webbit-rest-0.2.0.jar

Versions

Version
0.3.0
0.2.0
0.1.0