@@ -0,0 +1,1996 @@
+package com.vtence.molecule.examples.session;%0A%0Aimport com.vtence.molecule.Application;%0Aimport com.vtence.molecule.Request;%0Aimport com.vtence.molecule.Response;%0Aimport com.vtence.molecule.Session;%0Aimport com.vtence.molecule.middlewares.Router;%0Aimport com.vtence.molecule.routing.DynamicRoutes;%0Aimport com.vtence.molecule.simple.SimpleServer;%0Aimport com.vtence.molecule.simple.session.CookieTracker;%0Aimport com.vtence.molecule.simple.session.SessionPool;%0A%0Aimport java.io.IOException;%0A%0Apublic class EnablingSessions %7B%0A%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        SimpleServer server = new SimpleServer(8080);%0A%0A        // Enable sessions, using a cookie tracking strategy with an in-memory session pool%0A        server.enableSessions(new CookieTracker(new SessionPool()));%0A%0A        server.run(Router.draw(new DynamicRoutes() %7B%7B%0A%0A            map(%22/%22).to(new Application() %7B%0A                public void handle(Request request, Response response) throws Exception %7B%0A                    Session session = request.session(false);%0A                    String username = (session != null) ?%0A                            session.%3CString%3Eget(%22username%22) : %22Guest%22;%0A                    response.body(%22Welcome, %22 + username);%0A                %7D%0A            %7D);%0A%0A            post(%22/login%22).to(new Application() %7B%0A                public void handle(Request request, Response response) throws Exception %7B%0A                    String username = request.parameter(%22username%22);%0A                    request.session().put(%22username%22, username);%0A                    response.redirectTo(%22/%22);%0A                %7D%0A            %7D);%0A%0A            delete(%22/logout%22).to(new Application() %7B%0A                public void handle(Request request, Response response) throws Exception %7B%0A                    Session session = request.session(false);%0A                    if (session != null) session.invalidate();%0A                    response.redirectTo(%22/%22);%0A                %7D%0A            %7D);%0A        %7D%7D));%0A    %7D%0A%7D%0A

Add example showing basic session usage