title: How to read values from a JSF session map in a servlet filter?
body: <p>To authenticate with my Java EE webapp I have a <strong>login.xhtml</strong> JSF page associated with a <strong>LoginBean</strong>. The LoginBean saves a value into a session map, if the users has given valid login details:</p>
  
  <pre><code>FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("session-value", true);
  </code></pre>
  
  <p>Now I want to read that value (called "session-value") in a <strong>LoginFilter</strong> (implementation of javax.servlet.Filter) but I everytime I try to access the attribute, the console tells me that the attribute is null:</p>
  
  <pre><code> @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws Exception {
      HttpSession session = ((HttpServletRequest) request).getSession();
      Object attribute = session.getAttribute("session-value");
  
      if(attribute != null) {
        LOGGER.log(Level.INFO, ":)");
      } else {
        LOGGER.log(Level.INFO, "Attribute is null.");
      }
  
      chain.doFilter(request, response);
    }
  </code></pre>
  
  <p>Is it not possible to access the JSF session map with a call to the session of an HttpServletRequest?</p>