@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String connection = req.getHeader("connection"); System.out.println(connection); Enumeration<String> values = req.getHeaders("accept-encoding"); while (values.hasMoreElements()) { String value = values.nextElement(); System.out.println(value); } Enumeration<String> names = req.getHeaderNames(); while (names.hasMoreElements()) { String value = req.getHeader(names.nextElement()); System.out.println(value); } }
标签:HttpServletRequest,请求,req,System,value,获取,String,names,out From: https://www.cnblogs.com/weiduaini/p/17244315.html