根据访问地址截取根路径

来源:互联网 发布:百旺税控盘开票软件 编辑:程序博客网 时间:2024/06/15 13:05

1.需求请求地址的路径

 String requestPath = ((HttpServletRequest) request).getRequestURL().toString();

String baseUrl = requestPath.substring(0, requestPath.indexOf("/xxx")); //截取到请求方法之前 就是请求的根路径

0 0
原创粉丝点击