templates.index.html Maven / Gradle / Ivy
Show all versions of spincast-website Show documentation
{% extends "./layout.html" %}
{% block sectionClasses %}index{% endblock %}
{% block meta_title %}Java web framework{% endblock %}
{% block meta_description %}Highly Flexible Java Web Framework Based On Guice{% endblock %}
{% block scripts %}
{% endblock %}
{% block body %}
Power to the developers!
Spincast is an highly flexible
and open source Java web framework, based on Guice.
{#==========================================
Main content
==========================================#}
Why Spincast framework?
We live in a crazy world where the New Best Thing™ is always changing. Javascript,
that sucky language, is everywhere. Everybody thinks they are Netflix and that they need reactive not blocking
serverless functional GraphQL web scaled microservices on Kubernetes.
Stop this madness, please. What most of us really need are tools made for the real world. Tools that don't try to look cool,
but that work well and provide control and flexibility.
Spincast tries to be that framework that won't get you nerd points during a discussion, but
that actually gets the job done very well.
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();
}
}
{#==========================================
Right sidebar
==========================================#}
{# End right-sidebar #}
{# End row #}
{% endblock %}