//获取请求方式
String method = request.getMethod();
System.out.println("获取请求方式"+method);
//获取项目名称
String contextPath = request.getContextPath();
System.out.println("获取项目名称"+contextPath);
//获取Servlet的路径
String servletPath = request.getServletPath();
System.out.println("获取Servlet的路径"+servletPath);
//获取请求参数
String username = request.getParameter("username");
System.out.println("获取请求参数"+username);
//获取请求路径
//获取URI
String requestURI = request.getRequestURI();
System.out.println("获取URI"+requestURI);
//获取URL
StringBuffer requestURL = request.getRequestURL();
System.out.println("获取URL"+requestURL);
//获取协议及版本
String protocol = request.getProtocol();
System.out.println("获取协议及版本"+protocol);
//获取客户机IP地址
String remoteAddr = request.getRemoteAddr();
System.out.println("获取客户机IP地址"+remoteAddr);
posted on 2021-01-30 01:47  文种玉  阅读(175)  评论(0编辑  收藏  举报