jooby icon indicating copy to clipboard operation
jooby copied to clipboard

session: add formatter/encoder for complex object

Open jknack opened this issue 4 years ago • 0 comments

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

jknack avatar Jul 02 '20 20:07 jknack