fix session writing

After a wsgi wrapper returns the response is already been written and nothing else can be set. So that is why cookies or any other header cannot be set at that stage.
The solution is to write the cookie before the wsgi returns which means i had to reintroduce the SessionPlugin so that after the controller action is executed we can write the session.
 
So the session is initialize as soon as we get a request (in the middleware) and is written after each controller action is executed (in the plugin).