Get URL of the request sender with HttpServletRequest

后端 未结 3 671
抹茶落季
抹茶落季 2021-02-13 15:13

How do you get the source domain using HttpServletRequest? Source domain is the requester\'s domain.

Thanks.

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-13 15:48

    Hostname request

    InetAddress ip = InetAddress.getLocalHost();
    String hostname = ip.getHostName();
    out.print("Your current IP address : " + ip+"\n");
    out.print("Your current Hostname : " + hostname);
    

提交回复
热议问题