RequestDemoServlet:
package com.xxx.line;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RequestDemoServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//1、获得请求方式
String method = request.getMethod();
//2、获得请求的资源相关的内容
String requestURI = request.getRequestURI();
StringBuffer requestURL = request.getRequestURL();
//3、获得web应用的名称
String contextPath = request.getContextPath();
//4、获取GET参数
String queryString = request.getQueryString(); // name=zhangsan&age=20
//5、获得客户端IP地址
String remoteAddr