GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — -code-/WebRequestMethod at main · xiaoqidejava/-code- Expand file tree/ Copy pathWebRequestMethodMore file actions 37 lines (27 loc) · 1.31 KB / Copy pathWebRequestMethodFile metadata and controls37 lines (27 loc) · 1.31 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 public class RequestOtherMethod extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //获取请求的URL StringBuffer requestURL = req.getRequestURL(); //http://localhost:8080/requestOtherMethod_war_exploded/other System.out.println("requestURL=="+requestURL); //获取请求的URI: URL去掉请求协议及主机后的剩余部分 String requestURI = req.getRequestURI(); ///requestOtherMethod_war_exploded/other System.out.println("requestURI=="+requestURI); //获取当前Web应用的根路径 (重点) String contextPath = req.getContextPath(); System.out.println("contextPath=="+contextPath); //获取客户端IP String clientIP=req.getRemoteAddr(); System.out.println("clientIP=="+clientIP); //获取servlert xml中 url-patten 的精确部分 String servletPath = req.getServletPath(); // servletPath/other System.out.println("servletPath=="+servletPath); //获取servlet xml中 url-patten 的 通配符部分 String pathInfo = req.getPathInfo(); // pathInfo = null System.out.println("pathInfo =="+pathInfo); } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |