int endIndex = request.getRequestURL().length() - request.getPathInfo().length() + 1;
String url = request.getRequestURL().substring(0, endIndex);
可以获取http://www.test.com/ 或者http://127.0.0.1/duanzu/
int endIndex = request.getRequestURL().length() - request.getPathInfo().length() + 1;
String url = request.getRequestURL().substring(0, endIndex);
可以获取http://www.test.com/ 或者http://127.0.0.1/duanzu/