java获取请求的url参数

参考url:http://203.75.156.21:91/udap/

获取协议名: http

request.getScheme();

端口: 8080

request.getServerPort();

服务器: localhost

request.getServerName();

项目名: udap

request.getContextPath();

ServletPath: servlet/DemoServlet

request.getServletPath();

整个请求路径:” http://localhost:8080/kefuwebsocket/servlet/DemoServlet

request.getRequestURL()

项目的路径:”D:\Tomcat7.0\webapps\kefuwebsocket”

request.getSession().getServletContext().getRealPath(“”)

猜你喜欢

转载自blog.csdn.net/flw8840488/article/details/82969049
今日推荐