HttpServletRequest获取请求路径相关方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/buxin_2008/article/details/77854244

自己对基础知识有点忘记了,写下来当作备忘。

http://192.168.2.78/wkwm/wx/auth/view?custa=001&authb=2

System.out.println(request.getContextPath());// /wkwm
System.out.println(request.getPathInfo());// null
System.out.println(request.getPathTranslated());// null
System.out.println(request.getQueryString()); // custNo=001&authType=2
System.out.println(request.getRequestURI());// /wkwm/wx/auth/view
System.out.println(request.getRequestURL().toString());// http://192.168.2.78/wkwm/wx/auth/view
System.out.println(request.getServletPath());// /wx/auth/view

没有更多推荐了,返回首页