Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victorskl/1fc40dfcb0e707d1bd69 to your computer and use it in GitHub Desktop.
Save victorskl/1fc40dfcb0e707d1bd69 to your computer and use it in GitHub Desktop.
Print HttpServletRequest headers and their values
System.out.println(request.getMethod() + " : " + request.getRequestedSessionId());
Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = (String) headerNames.nextElement();
Enumeration headerValues = request.getHeaders(headerName);
while (headerValues.hasMoreElements()) {
String headerValue = (String) headerValues.nextElement();
System.out.println("\t" + headerName + " : " + headerValue);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment