jooby
jooby copied to clipboard
session: add formatter/encoder for complex object
Today HTTP session supports basic types (primitives and String mainly). Next release will allow adding arbitrary object to in-memory session and/or encode them for persistent implementation (redis, database, etc...)
{
install(new JacksonModule());
get("/", ctx -> {
User user = ...;
ctx.session().set("user", user);
})
}
The user
attribute is going to be keep in memory for in-memory session or encoded (json) for persistent implementations