Java simple web app framework.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc.bak
doc
src
.gitattributes
.gitignore
.travis.yml
pom.poml
pom.xml
readme.md

readme.md

Kaze: Java simple web app framework

Features

  • Easy to create RESTful API, Web API, etc
  • Runs on servlet containers
  • Supports embedded Jetty (Optional)
  • Minimal dependencies (Only Servlet API)

Hello World Example

1. Add Maven dependencies

<dependency>
  <groupId>com.github.mamorum</groupId>
  <artifactId>kaze</artifactId>
  <version>1.0.0</version>
</dependency>
<dependency>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-servlet</artifactId>
  <version>9.4.6.v20170531</version>
</dependency>

2. Create code

package kaze.sample.gs.html;

import kaze.App;
import kaze.opt.Jetty;

// app -> http://localhost:8080/app/hello
// doc -> http://localhost:8080/*
public class Main {
  public static void main(String[] args) {
    App app = new App();
    app.get("/hello", (req, res) -> {
      res.html("<p>Hello, World.</p>");
    });
    Jetty.app(app, "/app/*");
    Jetty.doc("/public", "/");
    Jetty.listen(8080);
  }
}

3. Run

gs> mvn compile
gs> mvn exec:java -Dexec.mainClass=kaze.sample.gs.html.Main

4. Check

> curl -s -X GET http://localhost:8080/app/hello
<p>Hello, World.</p>

Examples

  • gs: basic examples (above and json response).
  • rdb: web app accessing relational database, packaged as fatjar.
  • war: web app for servlet container, packaged as war.

Requirements

  • Java 8
  • Servlet 3.1
  • Jetty 9.4.6 (Optional)

And compatible higher versions.

Build Status