HttpServletRequest简述
生活随笔
收集整理的這篇文章主要介紹了
HttpServletRequest简述
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
HttpServletRequest簡述
HttpServletRequest httpServletRequest = (HttpServletRequest) request;/*getRequestURL方法返回客戶端發出請求時的完整URL。getRequestURI方法返回請求行中的資源名部分。getQueryString 方法返回請求行中的參數部分。getRemoteAddr方法返回發出請求的客戶機的IP地址getRemoteHost方法返回發出請求的客戶機的完整主機名getRemotePort方法返回客戶機所使用的網絡端口號getLocalAddr方法返回WEB服務器的IP地址。getLocalName方法返回WEB服務器的主機名getMethod得到客戶機請求方式*/String getRequestURL = httpServletRequest.getRequestURL().toString();String getRequestURI = httpServletRequest.getRequestURI();String getQueryString = httpServletRequest.getQueryString();String getRemoteAddr = httpServletRequest.getRemoteAddr();String getRemoteHost = httpServletRequest.getRemoteHost();int getRemotePort = httpServletRequest.getRemotePort();String getLocalAddr = httpServletRequest.getLocalAddr();String getLocalName = httpServletRequest.getLocalName();String getMethod = httpServletRequest.getMethod();System.out.println("#getRequestURL:"+getRequestURL);System.out.println("#getRequestURI:"+getRequestURI);System.out.println("#getQueryString:"+getQueryString);System.out.println("#getRemoteAddr:"+getRemoteAddr);System.out.println("#getQueryString:"+getQueryString);System.out.println("#getRemoteAddr:"+getRemoteAddr);System.out.println("#getRemoteHost:"+getRemoteHost);System.out.println("#getRemotePort:"+getRemotePort);System.out.println("#getLocalAddr:"+getLocalAddr);System.out.println("#getLocalName:"+getLocalName);System.out.println("#getMethod:"+getMethod);#getRequestURL:http://web.sy666.com:8088/admin/tenpay.do
#getRequestURI:/admin/tenpay.do
#getQueryString:sz_cash=222
#getRemoteAddr:192.168.1.202
#getQueryString:sz_cash=222
#getRemoteAddr:192.168.1.202
#getRemoteHost:192.168.1.202
#getRemotePort:-1
#getLocalAddr:web.sy666.com
#getLocalName:web.sy666.com
#getMethod:GET
?
轉載于:https://www.cnblogs.com/qsl568/p/3586387.html
總結
以上是生活随笔為你收集整理的HttpServletRequest简述的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python练习,随机数字 函数,循环,
- 下一篇: 常见的黑盒测试方法