title: Unable to access session data in servlet filter on app engine dev server
body: <p>I was trying to write a session filter to centralize authorization check in my app engine web app. </p>
  
  <p>My filter looks like this : </p>
  
  <pre><code>@Override
  public void doFilter(ServletRequest request, ServletResponse response,
          FilterChain chain) throws IOException, ServletException {
      HttpServletRequest httpReq = (HttpServletRequest) request;
      HttpServletResponse httpResp = (HttpServletResponse) request;
      HttpSession session = httpReq.getSession();
  
      httpReq.setCharacterEncoding("UTF-8");
      httpResp.setCharacterEncoding("UTF-8");
      httpResp.setContentType("application/json");
  
      Boolean isAuthorized = (Boolean) session.getAttribute("isAuthorized");
  
      if (!isAuthorized || isAuthorized == null) {
          httpResp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
      } else {
          chain.doFilter(request, response);
      }
  }
  </code></pre>
  
  <p>But when I'm launching app engine dev server I'm greeted with this exception : "org.mortbay.jetty.request cannot be cast to javax.servlet.http.httpservletresponse". What am I doing wrong?</p>