title: Dropwizard attribute is not being stored in the session
body: <p>I have a login screen on which i have a simple form with username and password fields. After successful login attempt I want to store user in the session and redirect to a home page.
  loginUser method is part of LoginResource class</p>
  
  <pre><code>@POST
      public View loginUser(@FormParam("user") String username, @FormParam("pass") String password, @Context HttpServletRequest req) 
      {
          LoginService ls = new LoginService();
          User user = ls.login(username, password);
          if(user == null)
              return new LoginView();
          else
          {
              req.setAttribute("appUser", user);
              req.getSession().setAttribute("appUser", user);
              return new HomeView();
          }
      }
  </code></pre>
  
  <p>HomeView class:</p>
  
  <pre><code>public class HomeView extends View
  {
  
      public HomeView()
      {
          super("home.ftl");
      }
  
  }
  </code></pre>
  
  <p>Freemarker template home.ftl:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;#if appUser??&gt;
              &lt;h1&gt;Welcome, ${appUser.username}!&lt;/h1&gt;
          &lt;#else&gt;
              AppUser is not found in the session
          &lt;/#if&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>run() method of the class that extends Service:</p>
  
  <pre><code>@Override
      public void run(Configuration configuration, Environment environment) throws Exception {
          //setting session handler
           environment.setSessionHandler(new SessionHandler());
           environment.addResource(new LoginResource());
     }
  </code></pre>
  
  <p>The problem is that when i make a successful login attempt it seems that my user is not saved in the session. Don't know how to resolve this.</p>