1.需求请求地址的路径
String requestPath = ((HttpServletRequest) request).getRequestURL().toString();
String baseUrl = requestPath.substring(0, requestPath.indexOf("/xxx")); //截取到请求方法之前 就是请求的根路径
版权声明:本文为shuist_king原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
1.需求请求地址的路径
String requestPath = ((HttpServletRequest) request).getRequestURL().toString();
String baseUrl = requestPath.substring(0, requestPath.indexOf("/xxx")); //截取到请求方法之前 就是请求的根路径