Java Other
Latest commit 3f27b50 Aug 13, 2018
Failed to load latest commit information.
maven-archetypes/quickstart [maven-release-plugin] prepare for next development iteration Jul 10, 2018
pippo-content-type-parent Tabs to spaces Jul 10, 2018
pippo-controller-parent Tabs to spaces Jul 10, 2018
pippo-core Solve #439 (Add DirEntry comparator in DirectoryHandler) Aug 8, 2018
pippo-css-parent [maven-release-plugin] prepare for next development iteration Jul 10, 2018
pippo-metrics-parent Add useful handlers for admin (#437) Jul 24, 2018
pippo-security-parent [maven-release-plugin] prepare for next development iteration Jul 10, 2018
pippo-server-parent [maven-release-plugin] prepare for next development iteration Jul 10, 2018
pippo-session-parent [maven-release-plugin] prepare for next development iteration Jul 10, 2018
pippo-template-parent Solve #440 Aug 13, 2018
pippo-test [maven-release-plugin] prepare for next development iteration Jul 10, 2018
pippo [maven-release-plugin] prepare for next development iteration Jul 10, 2018
.editorconfig add initial version for .editorconfig (see Jan 23, 2015
.gitignore Unit test Aug 8, 2016
.travis.yml Update travis jdk to 8 Dec 8, 2015 Update changelog Jul 10, 2018
LICENSE Create LICENSE Oct 10, 2017 Added logo. (#432) Jun 20, 2018
pippo-favicon.png Added logo. (#432) Jun 20, 2018
pippo-logo.png Added logo. (#432) Jun 20, 2018
pippo-logo.svg Added logo. (#432) Jun 20, 2018
pom.xml [maven-release-plugin] prepare for next development iteration Jul 10, 2018

Micro Java Web Framework

Join the chat at Travis CI Build Status Coverage Status Maven Central

It's an open source (Apache License) micro web framework in Java, with minimal dependencies and a quick learning curve.
The goal of this project is to create a micro web framework in Java that should be easy to use and hack.
The size of pippo-core is only 140 KB and the size of pippo-controller (optional) is only 45 KB.

Sample code

1. Routes approach

First we must create an Application and add some routes:

public class BasicApplication extends Application {

    protected void onInit() {
        // send 'Hello World' as response
        GET("/", routeContext -> routeContext.send("Hello World"));

        // send a file as response
        GET("/file", routeContext -> routeContext.send(new File("pom.xml")));

        // send a json as response
        GET("/json", routeContext -> {
            Contact contact = createContact();

        // send xml as response
        GET("/xml", routeContext -> {
            Contact contact = createContact();

        // send an object and negotiate the Response content-type, default to XML
        GET("/negotiate", routeContext -> {
            Contact contact = createContact();

        // send a template with name "hello" as response
        GET("/template", routeContext -> {
            routeContext.setLocal("greeting", "Hello");

    private Contact createContact() {
        return new Contact()
            .setAddress("Sunflower Street, No. 6");


where Contact is a simple POJO:

public class Contact  {

    private int id;
    private String name;
    private String phone;
    private String address;

    // getters and setters


The second step is to choose your favorite server, template engine and content type engine.
For example, I will choose Jetty as server, Freemarker as template engine, Jackson as JSON engine and JAXB as XML engine.
My Maven pom.xml looks like:





The last step it's to start Pippo with your application as parameter:

public class BasicDemo {

    public static void main(String[] args) {
        Pippo pippo = new Pippo(new BasicApplication());


Pippo launches the embedded web server (found in your classpath) and makes the application available on port 8338 (default value). Open your internet browser and check the routes declared in Application:

  • http://localhost:8338
  • http://localhost:8338/file
  • http://localhost:8338/json
  • http://localhost:8338/xml
  • http://localhost:8338/negotiate
  • http://localhost:8338/template

2. Controllers approach

Define controller(s):

public class ContactsController extends Controller {

    private ContactService contactService;

    public ContactsController() {
        contactService = new InMemoryContactService();

//    @Produces(Produces.HTML)
    public void index() {
        // inject "user" attribute in session
        getRouteContext().setSession("user", "decebal");

        // send a template with name "contacts" as response
            .bind("contacts", contactService.getContacts())

    @GET("/uriFor/{id: [0-9]+}")
    public String uriFor(@Param int id, @Header String host, @Session String user) {
        System.out.println("id = " + id);
        System.out.println("host = " + host);
        System.out.println("user = " + user);

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("id", id);

        String uri = getApplication().getRouter().uriFor("api.get", parameters);

        return "id = " + id + "; uri = " + uri;

    public List<Contact> getAll() {
        return contactService.getContacts();

    @GET("/api/{id: [0-9]+}")
    public Contact get(@Param int id) {
        return contactService.getContact(id);

public class FilesController extends Controller {

    public void index() {
        // send a template with name "files" as response

    public File download() {
        // send a file as response
        return new File("pom.xml");

    public String upload(FileItem file) {
        // send a text (the info about uploaded file) as response
//        return file.toString();
        return new StringBuilder()


Add controller(s) in your application:

public class BasicApplication extends ControllerApplication {

    protected void onInit() {
        addControllers(ContactsController.class); // one instance for EACH request
        // OR
        addControllers(new ContactsController()); // one instance for ALL requests



Don't forget that the Controller concept is included in pippo-controller module so you must add this module as dependency in your project.


Documentation is available on


Demo applications are available on pippo-demo
For a real life application built with Pippo please look at Web Accounting - Pippo Demo