日期:2014-05-20  浏览次数:20819 次

getHeader();getHeaderNames();这个header指的是什么?
程序如下:

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class RequestHeaderExample extends HttpServlet {

  public void doGet(HttpServletRequest request, HttpServletResponse response)
  throws IOException, ServletException
  {
  response.setContentType("text/html");
  PrintWriter out = response.getWriter();
  Enumeration e = request.getHeaderNames();
  while (e.hasMoreElements()) {
  String name = (String)e.nextElement();
  String value = request.getHeader(name);
  out.println(name + " = " + value);
  }
  }
}

------解决方案--------------------
http协议中的请求头,具体google,一般在程序开发中没什么意义