title: HttpServletRequest returning no cookies - but they exist
body: <p>We have a portlet based application that retrieves a certain cookie for validation and then sends off an action request afterwards.</p>
  
  <p>However, we're seeing an issue where the HttpServletRequest is returning a null list of cookies - even though I can 100% confirm there are cookies. In fact, sometimes the code DOES work and shows the cookies (although this is pretty rare).</p>
  
  <p>We've noticed that IE appears to work more frequently than FF and Chrome, but again, there's no consistency or pattern really to determine what causes it to function.</p>
  
  <p>The Request is always obtained - there's never an issue here of a null pointer. The only issue at this moment is that the cookie list is empty.</p>
  
  <p><strong>Method in static class that returns HttpServletRequest</strong></p>
  
  <pre><code>    FacesContext context = FacesContext.getCurrentInstance();
      Map&lt;String, Object&gt; requests = context.getExternalContext().getRequestMap();
      for (String requestName : requests.keySet()) {
  
          if (requests.get(requestName) instanceof HttpServletRequest) {
              return ((HttpServletRequest) requests.get(requestName));
          }
      }
      return null;
  </code></pre>
  
  <p><strong>Call from the other class to the static method above:</strong></p>
  
  <pre><code>        Cookie[] cookies = StaticClass.getHttpRequest().getCookies();
          System.out.println("Cookies = " + cookies);
  </code></pre>