Power to the developers!

Spincast is an highly flexible and open source Java web framework, based on Guice.

NO LONGER MAINTAINED

Please note that Spincast is no longer maintained.

A simple but fully working application:

public class App {

    public static void main(String[] args) {
        Spincast.init(args);
    }

    @Inject
    protected void init(DefaultRouter router, Server server) {
        router.GET("/").handle(context -> context.response().sendHtml("<h1>Hello World!</h1>"));
        server.start();
    }
}

When needed, you have access to a lot of power and flexibility...

public class App {

    public static void main(String[] args) {
        Spincast.configure()
                .module(new AppGuiceModule())
                .plugin(new SpincastHttpClientPlugin())
                .plugin(new SpincastJdbcPlugin())
                .plugin(new SpincastFormsProtectionPlugin())
                .plugin(new SpincastScheduledTasksPlugin())
                .plugin(new SpincastSessionPlugin())
                .requestContextImplementationClass(AppRequestContextDefault.class)
                .init(args);
    }

    @Inject
    protected void init(AppRouter router, AppServer server) {
    
        router.methods(HttpMethod.POST, HttpMethod.PUT)
              .path("/users/${userId:<N>}")
              .accept(ContentTypeDefaults.JSON)
              .handle(context -> {
        
            context.response().setCacheSeconds(3600);
            context.response().setCookie1year("myCookie", context.customMethodYouDefined());
            context.response().setHeader("x-powered-by", "Robert'); DROP TABLE Students;--");

            JsonObject userObj = context.json().create();
            userObj.set("user.id", context.request().getPathParam("userId"));
            userObj.set("user.timeZone", context.getTimeZoneToUse());
            userObj.set("user.locale", context.getLocaleToUse());
            
            System.out.println(userObj.toJsonString(true));
            // {
            //     "user" : {
            //         "id" : "42",
            //         "timeZone" : "America/New_York",
            //         "locale" : "en_US"
            //     }
            // }

            context.response().sendXml(userObj);
        });
        
        server.start();
    }
}

Web applications and APIs

Spincast is a java web framework to serve as a backend for Single Page Applications (SPA), to develop HTML generated websites or to be a REST API services platform.

Flexible...

Spincast is based on Guice from the ground up. It is very flexible: each part can be tweaked/overridden, even the core classes. There are no static methods and no private methods.

.... very flexible!

Spincast aims to feel more like a library than like a framework. It is not opinionated and favors configuration over convention. Its main goal is to give power to the developers.

Modular

Spincast is composed of a small core and a big plugins ecosystem. You choose what your application needs.

HTTP/2
and WebSockets

HTTP/2 and WebSockets are fully supported!

Embedded server

The embedded server makes everything easy to develop, test and deploy... When deployed, the application is fully contained, in a single executable .jar file.

Powerful router

Spincast's powerful router is injectable and dynamic. That means you can add and remove routes from anywhere in your application, at any time.

Well tested

Spincast is fully tested and even provides its own Testing utilities.