这是常用的request获取服务地址的常用方式。

源请求服务地址:http://localhost/api-server/1/forum/thread/hot_topic?sex=1

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

这个截取结果:http://localhost:80/api-server/

相关文章:

  • 2021-07-05
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-04
  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
相关资源
相似解决方案