title: Headers and Getters in HttpServletRequest
body: <p>I am working with HttpServletRequest, and I must output all headers and information from that object.</p>
  
  <p>for the headers I am using <code>getHeadersNames()</code> </p>
  
  <pre><code>Enumeration&lt;String&gt; headerEnums = servletRequest.getHeaderNames();
  while (headerEnums.hasMoreElements()) {  
      String elementName = headerEnums.nextElement();
      String elementValue = servletRequest.getHeader(elementName);
      sb.append("Header.").append(elementName).append("=").append(elementValue).append(", ");
  }
  </code></pre>
  
  <p>and afterwards I am retrieving all parameters using getters, for example:</p>
  
  <pre><code>sb.append("getAuthType").append("=").append(servletRequest.getAuthType());
  </code></pre>
  
  <p>I am getting duplicate arguments for example <code>Header.content-type</code> and <code>ContentType</code> from <code>getContentType()</code></p>
  
  <p>my questions:</p>
  
  <ol>
  <li>There is a nice way to output all <code>servletRequest</code> parameters without iterate over <code>headers</code>, <code>attributes</code> and getters? like toString()?</li>
  <li>How can i avoid retrieving duplicate arguments without having a temporal set?</li>
  <li>Is it possible to have an header inside Headers where its getter is empty? for example: <code>content-type</code> exist in Headers but <code>getContentType()</code> is null?</li>
  </ol>