Spark

Spark is a Sinatra inspired open source web framework for quickly creating web applications in Java with minimal effort.

Spark focuses on being as simple and straight-forward as possible, without the need for cumbersome (XML) configuration, to enable very fast web application development in pure Java.

Hello World with path parameter example:

import static spark.Spark.*;
import spark.*;

public class HelloWorld {
   public static void main(String[] args) {

      get(new Route("/hello/:name") {
         @Override
         public Object handle(Request request, Response response) {
            return "Hello World: " + request.params(":name");
         }
      });

   }
}

For the full feature set, check the documentation: http://www.sparkjava.com/readme.html
For the source code, check: https://github.com/perwendel/spark

Leave a Reply

Close Menu