Skip to content
A very simple web stack.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


SimpleWeb4j - A very Simple web stack.

Why SimpleWeb4j

My current way to create web application is angular.js on client side, with twitter bootstrap for css, and have json resources on server side. So I want a very simple framework to help create this kind of web app.

It's why I created SimpleWeb4j, on server side, you can handle http request in order to create quickly json services, and on client side create an angular.js app (you can also use others javascript framework, but I prefer angular).


  • Jetty : used for http server.
  • slf4j : For the logs.
  • gson : use to serialize/deserialize json objects.
  • Hibernate : Use for entities management.
  • H2 : use by default for database (you can exclude it if you use another database or if you don't use databases).


All SimpleWeb4j is under the Apache License, Version 2.0


Maven dependency


Cloudbees clickstart

The fastest way to create a SimpleWeb4j application is to use clickstart.

All clickstart contain a sample of Beers CRUD with :

- Git repository
- Jenkins instance.
- Database support.
- Test of REST services
- Test of GUI with fluentlenium.

Clickstart with mysql :

Clickstart with mongo :

Your first application

Create you main class :

package fr.mygroup;

import static fr.ybonnel.simpleweb4j.SimpleWeb4j.*;

public class MyApplication {

    public static void startServer(int port) {
        // Put all your static resource under a package named "fr.mygroup.public"
        // Rest resource sample
        resource(new RestResource<String>("resource", String.class) {
            public String getById(String id) throws HttpErrorException {
                return "myResource";

            public List<String> getAll() throws HttpErrorException {
                return new ArrayList<String>();

            public void update(String id, String resource) throws HttpErrorException {

            public String create(String resource) throws HttpErrorException {
                return resource;

            public void delete(String id) throws HttpErrorException {
        // Get sample
        get("/hello", () -> new Response<>("Hello World"));


    public static void main(String[] args) {
        // Start the server on port 9999.

After started server, you will see "Hello World" is you access to "http://localhost:9999"

Now, just add you static files under the package set with "setPublicResourcesPath", and start using angular.js or what ever you want.

Static files embedded with SimpleWeb4j

SimpleWeb4j comes with angular, jquery and twitter bootstrap. All the resources of SimpleWeb4j are under the package fr.ybonnel.simpleweb4j.public

Use maven archetype

In order to create a project very quickly, you can use the archetype fr.ybonnel:simpleweb4j-archetype:0.0.4.

mvn archetype:generate -DarchetypeGroupId=fr.ybonnel -DarchetypeArtifactId=simpleweb4j-archetype -DarchetypeVersion=0.0.4 -DgroupId=com.exemple -DartifactId=myapp -Dpackage=com.exemple.myapp -DclassName=MyApp -DwithHibernate=true -Dversion=0.0.1-SNAPSHOT

Archetype parameters :

  • groupId : your groupId.
  • artifactId : your artifactId.
  • package (default = groupId) : the main package of your application.
  • className (default = "HelloWorld") : the name of your main class.
  • withHibernate (default = "true") : true if you want the entity managment, false otherwize.
  • version : your version.


I've created three samples which can be found in the test resources under the package "fr.ybonnel.simpleweb4j.samples".

All samples are directly inspired by play framework, which is a great web framework.

Build status

Build Status

Other documentation

You can find all the generated maven site in jenkins


You can’t perform that action at this time.