request获取项目名称,获取访问路径url

// /archeshein/supplyDemo/selectSupplyDemoEntites 获取uri

String requestURI = request.getRequestURI();


// /archeshein 获取项目名称

String contextPath = request.getContextPath();


// http 获取协议

String scheme = request.getScheme();


// localhost 获取ip

String serverName = request.getServerName();


// 9091 获取端口

int serverPort = request.getServerPort();


// http://localhost:9091/archeshein/supplyDemo/selectSupplyDemoEntites 获取全路径url

StringBuffer requestURL = request.getRequestURL();


// /supplyDemo/test 获取资源路径
String servletPath = request.getServletPath();

你可能感兴趣的:(request获取项目名称,获取访问路径url)