通过HttpServletRequest获取服务器路径

String scheme = request.getScheme();
        String serverName = request.getServerName();
        int port = request.getServerPort();
        String path = request.getContextPath();
        String basePath = scheme + "://" + serverName + ":" + port + path;

 

你可能感兴趣的:(通过HttpServletRequest获取服务器路径)