content: import java.io.IOException;
  import java.io.PrintWriter;
  import java.util.Enumeration;
  
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  @WebServlet(description = "Display requests", urlPatterns = { "/request" })
  public class Request extends HttpServlet {
  	private static final long serialVersionUID = 1L;
  
  	protected void doGet(HttpServletRequest request, HttpServletResponse response)
  			throws ServletException, IOException {
  		response.setContentType("text/html");
  
  		PrintWriter out = response.getWriter();
  
  		out.println("<html>\n" + "<head><title> HTTP Headers </title></head>\n"
  				+ "<body bgcolor = \"#f0f0f0\">\n" + "<h1 align = \"center\"> HTTP Headers </h1>\n"
  				+ "<table width = \"100%\" border = \"1\" align = \"center\">\n" + "<tr bgcolor = \"#949494\">\n"
  				+ "<th>Header Name</th><th>Header Value(s)</th>\n" + "</tr>\n");
  
  		Enumeration<String> headerNames = request.getHeaderNames();
  
  		while (headerNames.hasMoreElements()) {
  			String paramName = (String) headerNames.nextElement();
  			out.print("<tr><td>" + paramName + "</td>\n");
  			String paramValue = request.getHeader(paramName);
  			out.println("<td> " + paramValue + "</td></tr>\n");
  		}
  		out.println("</table>\n</body></html>");
  	}
  
  	protected void doPost(HttpServletRequest request, HttpServletResponse response)
  			throws ServletException, IOException {
  		doGet(request, response);
  	}
  
  }
  