The source code of ShowHeaders.java : import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class ShowHeaders extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html") ; PrintWriter out = response.getWriter() ; out.println("<!DOCTYPE HTML PUBLIC " +"\"-//W3C//DTD HTML 4.01 " +"Transitional//EN\">") ; out.println("<html>") ; out.println("<head>") ; out.println(" <title>Showing the request headers</title>") ; out.println("</head>") ; out.println("<body>") ; out.println("<h2>The request headers</h2><hr><br>") ; java.util.Enumeration en = request.getHeaderNames(); while (en.hasMoreElements()) { String name = (String)en.nextElement(); out.println("<b>"+name+"</b> : " + request.getHeader(name) + "<br>"); } out.println(" </body>") ; out.println("</html>") ; } }