Last active
July 29, 2019 16:03
-
-
Save trepidity/7494bb427c3a19b197c5 to your computer and use it in GitHub Desktop.
Prints headers that NAM injects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ page import="java.util.*" %> | |
<html> | |
<head> | |
<title>NAM Diag Headers</title> | |
</head> | |
<body> | |
<h1>HTTP Request Headers Received</h1> | |
<table border="1" cellpadding="4" cellspacing="0"> | |
<% | |
Enumeration eNames = request.getHeaderNames(); | |
while (eNames.hasMoreElements()) { | |
String name = (String) eNames.nextElement(); | |
String value = normalize(request.getHeader(name)); | |
%> | |
<tr><td><%= name %></td><td><%= value %></td></tr> | |
<% | |
} | |
%> | |
</table> | |
</body> | |
</html> | |
<%! | |
private String normalize(String value) | |
{ | |
StringBuffer sb = new StringBuffer(); | |
for (int i = 0; i < value.length(); i++) { | |
char c = value.charAt(i); | |
sb.append(c); | |
if (c == ';') | |
sb.append("<br>"); | |
} | |
return sb.toString(); | |
} | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment