code: protected String getAddress(HttpServletRequest request){
          String path = request.getScheme()+"://"+request.getServerName();
          //port
          if(request.getScheme().equals("http")&&request.getServerPort()!=80)
              path+=":"+request.getServerPort();
          if(request.getScheme().equals("https")&&request.getServerPort()!=443)
              path+=":"+request.getServerPort();
          path+=request.getRequestURI();
          return path;
      }
docs: Get current service address
  
  @param request
  @return