{ System.out.println("request.getAuthType():" + request.getAuthType()); // 获取保护servlet的认证方案名(BASIC或SSL),未受保护的servlet返回的就是null System.out.println("request.getCharacterEncoding():" + request.getCharacterEncoding()); // 获取字符编码 System.out.println("request.getContentLength():" + request.getContentLength()); // 返回请求体内容的长度 System.out.println("request.getContentType():" + request.getContentType()); // 获取内容类型 System.out.println("request.getContextPath():" + request.getContextPath()); // 获取上下文路径,就是"/"+工程名 System.out.println("request.getLocalAddr():" + request.getLocalAddr()); // 获取应用服务器的IP地址 System.out.println("request.getLocalName():" + request.getLocalName()); // 获取应用服务器的主机名 System.out.println("request.getLocalPort():" + request.getLocalPort()); // 获取应用服务器的端口号 System.out.println("request.getMethod():" + request.getMethod()); // 获取请求方式获取请求方式(GET与POST为主,也会有PUT、DELETE、INPUT) System.out.println("request.getPathInfo():" + request.getPathInfo()); System.out.println("request.getPathTranslated():" + request.getPathTranslated()); System.out.println("request.getProtocol():" + request.getProtocol()); // 获取客户端向服务端传送数据使用的协议名称 System.out.println("request.getQueryString():" + request.getQueryString()); // 获取追加到Url后面的查询字符串 System.out.println("request.getRemoteAddr():" + request.getRemoteAddr()); // 获取发出请求的客户端的IP地址 System.out.println("request.getRemoteHost():" + request.getRemoteHost()); // 获取发出请求的客户端的主机名 System.out.println("request.getRemotePort():" + request.getRemotePort()); // 获取发出请求的客户端的端口号 System.out.println("request.getRemoteUser():" + request.getRemoteUser()); // 如果用户已经过认证,则返回发出请求的用户登录信息 System.out.println("request.getRequestedSessionId():" + request.getRequestedSessionId()); // 获取sessionId System.out.println("request.getRequestURI():" + request.getRequestURI()); // 获取"/"+工程名+请求路径 System.out.println("request.getRequestURL():" + request.getRequestURL()); // 获取完整的请求地址,不带queryString System.out.println("request.getScheme():" + request.getScheme()); // 获取当前链接使用的协议,一般应用就是http,SSL返回https System.out.println("request.getServerName():" + request.getServerName()); // 获取URL请求的名字(以Ip请求就是Ip,以域名请求就是域名) System.out.println("request.getServerPort():" + request.getServerPort()); // 获取URL请求的端口号 System.out.println("request.getServletPath():" + request.getServletPath()); // 获取请求路径 System.out.println("request.isSecure():" + request.isSecure()); // 获取此请求是否使用安全协议(比如https) }