protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //获取所有请求头名称 Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String name = headerNames.nextElement(); //根据名称获取请求头的值 String value = request.getHeader(name); System.out.println(name+"---"+value); } }