JERSEY: How to retrieve the calling IP or URI using injection annotation?

后端 未结 3 1802
生来不讨喜
生来不讨喜 2021-02-13 10:28

I have a REST- Server here using JERSEY. I must log the IP (better the DNS) of the calling client.

Can somebody point a direction which injection annotations to use ?

3条回答
  •  我寻月下人不归
    2021-02-13 10:47

    In case you use Grizzly-Jersey combo, thats the way to do it:

    @Context
    private java.lang.ThreadLocal grizzlyRequest;
    

提交回复
热议问题