1 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 2 //获取所有请求头名称 3 Enumeration headerNames= request.getHeaderNames(); 4 while (headerNames.hasMoreElement
2 //获取所有请求头名称
3 Enumeration
headerNames= request.getHeaderNames();
4 while (headerNames.hasMoreElements()) {
5 String name= headerNames.nextElement();
6 //根据名称获取请求头的值
7 String value= request.getHeader(name);
8 System.out.println(name+"---"+value);
9 }
10
11 }