title: httpservletrequest getCookies() or getHeader()
body: <p>I want to accept data from a client.
  What are the pros and cons of each approach?</p>
  
  <pre><code>HttpServletRequest request = retriveRequest();
  Cookie [] cookies = request.getCookies();
  for (Cookie cookie : cookies) {
       if ("my-cookie-name".equals(cookie.getName())) {
            String value = cookie.getValue();
           //do something with the cookie's value.
       }
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>String request.getHeader("header-name");
  </code></pre>
  
  <p>As I read <a href="https://stackoverflow.com/questions/3467114/how-are-cookies-passed-in-the-http-protocol">How are cookies passed in the HTTP protocol?</a></p>
  
  <blockquote>
    <p>Cookies are passed as HTTP headers, both in the request (client -> server), and in the response (server -> client).</p>
  </blockquote>